Skip to main content

J2ME need help,j2me append=true error

1 reply [Last post]
angie_ong
Offline
Joined: 2007-05-16
Points: 0

I wanna output multiple answer to the text file i create in the root location.

but if i put

try{
String uri = "file:///root1/myfile2.txt;append=true";
OutputConnection connection = (OutputConnection)
Connector.open(uri, Connector.WRITE );
OutputStream out = connection.openOutputStream();
printStream output = new PrintStream( out );
output.print( "Answer 1 is:\n\n" + list.getString(x)); out.close();
connection.close();
}

the append=true will cause error:java.io.IOException:

if i remove the append=true , i can save the date....but only one data is save to the text file each time.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
astrientlabs
Offline
Joined: 2006-09-14
Points: 0

Try using "openOutputStream(long byteOffset)"

You can position the output stream at the end of the file. All new bytes (pos>=length) will then be appended to the file.