Home Demos Forum Research Guide
Viewing topic in forum 'general'
back to topic list

File Input
I will like to append content to a file. How can i achieve this. Current library only allows one to overwrite content of a file.
by enesi on 2015-07-06 13:40:19 (1 reply)

Hi,

Apologies; in the current release there was indeed no way to do this. However, this was not the intended behaviour of the File component.

It has now been updated within the current release (if you download this one it will contain the new component).

Using the updated version, the procedure to add to the end of a file is:


File fd = new File("log.txt", File.FILE_ACCESS_WRITE);
fd.setPos(fd.getSize());
fd.write("a new line\r\n");
fd.close();
 


So we open the file for writing, seek to the end of the file, then write our new data.

Hope that helps & thanks for the question.

- Barry
by barry on 2015-07-06 17:04:39
© Francis Research Ltd. 2017