Write something to the next available line in a file
The title basically says. What I'm trying to do it to get the output of the my program to write to a text file (which i have working) but I want to to go a the next empty line every time the program is ran instead of over-writing what is already saved. Ived tried making a Scanner and using nextLine() but that apperently only works for handling input not writing to a text file. Any help would be appreciated!
Re: Write something to the next available line in a file
How are you writing to the file? Which class are you using? Have you looked at what constructors that class has?
Re: Write something to the next available line in a file
Quote:
Originally Posted by
frozen java
The title basically says. What I'm trying to do it to get the output of the my program to write to a text file (which i have working) but I want to to go a the next empty line every time the program is ran instead of over-writing what is already saved. Ived tried making a Scanner and using nextLine() but that apperently only works for handling input not writing to a text file. Any help would be appreciated!
Read PrintWriter or FileWriter class if you are writing in a file using PrintWriter or FileWriter and see it's constructor's docs, you will for sure find the solution.