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

Username:   Password: 
 RegisterRegister   
 file output
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HeavenAgain




PostPosted: Thu Nov 01, 2007 11:23 pm   Post subject: file output

whats the standard file output for java now?
i'm using PrintWriter + BufferedWriter + FileWriter is it out dated? Neutral

and another question for PrintWriter, if i were to use it to write a file, it will always start at the beginning of the file, but say theres already something in the file, and i dont want to over write it, how do i skip all those and go to the end? any special method?
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Fri Nov 02, 2007 2:50 pm   Post subject: RE:file output

You can just do something like

PrintStream pr = new PrintStream(new FileWriter(...));
pr.println("Bacon");
pr.print("eg");
pr.print("gs\n");
HeavenAgain




PostPosted: Fri Nov 02, 2007 3:10 pm   Post subject: RE:file output

what about skipping to the end of the file instead of over writing?
Euphoracle




PostPosted: Fri Nov 02, 2007 5:41 pm   Post subject: RE:file output

Add the argument `append` (second one for FileWriter contructor) the value of `true`.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: