Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Resolved Resolved by DJ Sures!

Reading And Writing Files In Java

I am not a Java expert.  Can someone post an example of how to open/write and open/read a file on my local computer using the ARC Java Script editor?

Thank you very much.

Related Hardware EZ-Robot EZ-B v4
AI Support Bot
Related Content
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
#1   — Edited
I believe you mean JavaScript. Synthiam does not support anything Java related. There's a big difference (not only in the spelling) of Java and JavaScript:)

Use the File class to write files. Type File and hit . and all of the related stuff will appear.
User-inserted image


var filename = "C:\\temp\\testfile.txt";

File.appendString(filename, "Some data to write");

var x = File.readLine(filename);


Thanks.  No where could if find i needed a double \\ in the file path.
In programming, a \n in a string means new line. or \t means tab. There's a whole list of "escape characters" for strings.
I found this for ya on google 

JavaScript String Escape / Unescape

Escapes or unescapes a JavaScript string removing traces of offending characters that could prevent interpretation.

The following characters are reserved in JavaScript and must be properly escaped to be used in strings:

Horizontal Tab is replaced with \t
Vertical Tab is replaced with \v
Nul char is replaced with \0
Backspace is replaced with \b
Form feed is replaced with \f
Newline is replaced with \n
Carriage return is replaced with \r
Single quote is replaced with \'
Double quote is replaced with \"
Backslash is replaced with \\
Thank you.  Learning as i go.