Hi
Is there an easy way to append strings at the end of a file?
I saw somewhere "filename.txt;append=true" as file name but i cant believe that would work... (tested it too)
Your help will be apreciated
Hi
Is there an easy way to append strings at the end of a file?
I saw somewhere "filename.txt;append=true" as file name but i cant believe that would work... (tested it too)
Your help will be apreciated
Use fileSize() to get the size of the file.
Then when you want to write to it, use openOutputStream() with an argument that sets the offset to the end of the file (size of the file) and start writing.
If you set the parameter (offset) to the maximum value of a long, then you don't need to get the size/length of the file. The SDK docs for JSR-75 and this method says: "If the provided offset is larger than or equal to the current file size, the OutputStream is positioned at the current end of the file for appending."
FileConnection connection = ()Connector.open(url,Connector.write);
OutputStream stream = connection.openOutputStream(long byteOffset) ;
stream.write(byte[]);
stream.flush();
stream.close();
connection.close();
stream = null;
connection = null;
check and reply..
thanks,
jitu_goldie..
KEEP TRYING..