File.read() returns nothing for .txt file
Hi,
I'm searching a way to read (and subsequently edit) the contents of a text file on my disk. I thought it works with the File.read() function but when I run the following I get nothing from the file. How does it work? How do I get the string with the file content? I tried different functions like readln() etc but with no luck
| var testtextfile = File("/c/users/bernhard-büro/desktop/text.txt"); | |
testtextfile.open("r", undefined, undefined); //also tried with .open("r"); and .open('r'); | |
| var fileContentsString = testtextfile.read(); |
| alert("Full path: "+testtextfile.fsName+"\r\n"+ | |
| "File content:"+fileContentsString+"\r\n"+ | |
| "fileContentsString length:"+fileContentsString.length); | |
| testtextfile.close(); |
this is the result: (and what is the proper way to format code in this forum?)
Thank you very much!
Cheers

