question about default of outFile()
hey guys, how do i change the default of throws FileNotFoundException so that it would not automatically erase the contents in my desired output file.
my aim is to inFile() and outFile() the contents in the same location.
this:
my problem is the contents in the vending_machine text file automatically goes blank right after i run the program. So how should i change the default and change it to not automatically erasing the contents of the text file. Thanks!
Sorry for my horrible english and grammar. haha
Re: question about default of outFile()
Ok, well my guess is that it isnt that the text file goes blank, but rather that the exception is thrown prior to completing the writing or the closing. Without code to see, I wont really know what is going on.
Re: question about default of outFile()
I believe if you create your PrintWriter from a FileOutputStream with the append option on, it should append everything you write at the end of the file.
As a side-note, I don't think you should have the same file open for reading/writing at the same time. Instead, you should close/re-open the stream between reads/writes.