Is it possible to use processing to read and write text file .?

Home Forums Procoding Is it possible to use processing to read and write text file .?

Tagged: , ,

This topic contains 3 replies, has 1 voice, and was last updated by  audiocommander 2 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1060

    Sukij

    I tried to use Processing language to reading and writing text file
    do you have any suggestion ..?

    Thx

    #1061

    audiocommander
    Keymaster

    Hi Sukij,

    Procoding uses Processing.js that runs in the built-in Safari Mobile browser. Because of any browser’s security restrictions, reading and in particular writing local files is practically impossible (you really don’t want some shady websites you visit accidentally saving files on your hard drive).

    However, processing.js provides loadString() and saveStrings()
    http://processingjs.org/reference/saveStrings_/

    There’s also loadBytes, but you might run into problems, depending on weather you’re running the sketch locally or hosted on a webserver and the browser you are using.

    Hope this helps,
    regards,
    Michael

    #1063

    Sukij

    Thx for kindly ans :}

    Im running the sketch locally :} So i have to save like this

    saveStrings(“/resources/nouns.txt”, list);

    can I download this file by iTunes ..?

    #1064

    audiocommander
    Keymaster

    Hi,

    sorry – no, you can’t. As I said, it’s not possible to create and write local files from JavaScript (processing.js is in fact JavaScript running on a website).
    I don’t know the exact implementation of processing.js (would have to go to github and look up the code for saveStrings), but I suppose they are using localStorage, something like a cookie in the browser’s database.

    I think you might find some answers in processing/processing.js related forums, as there might be other ways to achieve what you probably want to achieve. There’s a lot of information out there about this: https://www.google.com/search?q=processingjs+write+file

    If you have a question specifically related to Procoding, I’m happy to help you further,

    best,
    Michael

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Is it possible to use processing to read and write text file .?’ is closed to new replies.