Thread: File Handling
View Single Post
  #2   Spotlight this post!  
Unread 19-02-2010, 20:47
rrossbach rrossbach is offline
Registered User
AKA: Ron R
FRC #2607 (RoboVikings)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Warrington PA
Posts: 90
rrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to behold
Arrow Re: File Handling

Look at the javadocs for the following classes:

com.sun.squawk.microedition.io.FileConnection
javax.microedition.io.Connector
java.io.DataOutputStream
java.io.DataInputStream

For example, to create an output file on the cRIO:

DataOutputStream theFile;
FileConnection fc;

try {
fc = (FileConnection)Connector.open("file:///output.txt", Connector.WRITE);
fc.create();
theFile = fc.openDataOutputStream();
} catch (Exception e) {
...
}

You can then use the writeXXX() methods in DataOutputStream to write to the file. Be sure to flush() also.

- Ron
Team #2607 controls mentor