Problem is that I only get one line written to foo.txt, and each time I run the program it overwrites that one line with another value.
Expected results are at least 4 lines would be written in foo.txt each time I run program.
Re: BufferedWriter cannot append to file ....just overwrites
Jan 24, 2006 9:11 AM
(reply 5
of 5) (In reply to
#4 )
I dont suppose that you know if it is possible to
append to the top (beginning)of the file?
That would be inserting. To do that, you could store the whole file, then rewrite the file, putting the old data after your new data.
Or you could create a new file, write the new data to it, then read the old file and write the data there to the new file. After that, delete the old file and rename the new file.