Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Save file directly on dropbox

edited July 2013 in Questions Posts: 304

Do you think it was possible with io or something like this ?


  • dave1707dave1707 Mod
    Posts: 8,182

    @HyroVitalyProtago Here is a small example of writing and reading using "io" functions. Just remember that there isn't a directory function, so if you write outside of Dropbox, you can't see the file names. You'll have to sync Dropbox to see the file.

    function setup()     local file = os.getenv("HOME").."/Documents/Dropbox.spritepack/myFile1.txt"     txt="abcdefghijklmnopqrstuvwxyz\n"          if file ~=nil then         writeData(file)             readData(file)     end end function writeData(file)     print("----- start write -----")     wFd =,"w")     wFd:write(txt)    -- write some letters from txt     for z= 1,20 do         wFd:write(z.." ")    -- write some numbers     end     wFd:close()     print("----- stop write -----\n") end function readData(file)     print("----- start read -----")     rFd =,"r")     while 1 do         data=rFd:read()         if data==nil then             rFd:close()             break         end         print(data)     end     print("----- stop read -----\n") end
  • thanks a lot !

  • Sorry for this basic question.

    The above code runs fine on my machine. I can even write and read different files (written with different data) and get the respective data.

    However, where are the files. The comment says "You'll have to sync Dropbox to see the file." How do you do this. I have looked into the files on my Dropbox account from the Dropbox app, Goodreader, and my PC (which, of course, is synced to my Dropbox account.)


  • edited July 2013 Posts: 304

    You have two choice :

    • First, At the home of codea, on the left menu (with shader lab, codea air, ...), open sprite, open dropbox directory and you have the sync button.

    • Second, open sprite directly in your app with a click on the command readImage() or sprite() and do the same that in first. (open dropbox directory and you have the sync button)

  • Fantastic! Thanks @HyroVitalyProtago.

    I don't think I would ever have thought to look in the "sprite" tab.

    I think that being able to read/write files to one's Dropbox account is a major benefit. Not only can it be used with more mundane text file applications, I think that it will be a great benefit for debugging by allowing the saving of data and then viewing.

    Thanks again.


Sign In or Register to comment.