This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to write at the end of text file  RSS feed

 
Myurawagan Poobalasingam
Greenhorn
Posts: 2
C++ Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Every time it is overwritting. rather than adding next line of records.
public void WriteToFile(){

try{

FileWriter writer = new FileWriter ("record.txt");

writer.append(v +"\t");
writer.append(u +"\t");
writer.append(x );

writer.close();
}catch(IOException ex){
ex.printStacktrace();
}
}
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
143
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

This post has been moved to a more appropriate forum.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to look at the API for various FileWriter constructors. In particular, look at the constructors that accept a boolean argument. Those will provide what you need.
 
Myurawagan Poobalasingam
Greenhorn
Posts: 2
C++ Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Jim but i ma really a beginner to java. if you could give me an example that would really get me giong.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!