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