Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File writing

 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code below rewrites the file each time, can i make it to append each time i run instead of overwriting.
 
Nischal Topno
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try the overloaded constructor of FileWriter(String fileName, boolean append). So in your case it will be
FileWriter fw = new FileWriter("Rule.xml", true);
 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic