• Post Reply Bookmark Topic Watch Topic
  • New Topic

Open a .txt file that already exists and add data  RSS feed

 
Star Bak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone.I want to open a .txt file and if the name already exists,i want to add data after the existing data.
Here is the code'
below the "else" i want to open the existing file and NOT lost the writen data.
thanks in advance
 
Jan Cumps
Bartender
Posts: 2632
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java.io.FileWriter has a constructor that allows you to open a file for appending.
It will try to create a file for you if it does not exist.
If the file exists, it will append data at the end.

 
Star Bak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:java.io.FileWriter has a constructor that allows you to open a file for appending.

thank you very much!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!