Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 PrintWriter deletes contents of file
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Justin_




PostPosted: Thu Apr 27, 2006 8:32 pm   Post subject: PrintWriter deletes contents of file

code:

PrintWriter output = new PrintWriter(new FileWriter(inputFile));


How do i make it open the file for writing without deleting the contents of the file?
Sponsor
Sponsor
Sponsor
sponsor
Justin_




PostPosted: Thu Apr 27, 2006 8:36 pm   Post subject: (No subject)

Please whatever you do, don't suggest that I copy the contents of the file in an array first.
wtd




PostPosted: Thu Apr 27, 2006 9:46 pm   Post subject: (No subject)

You're trying to "append" to the file. The FileWriter class makes this quite easy to do.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: