| Author |
how adding text in a file (not rewriting the hole file)
|
Wall Schnok
Greenhorn
Joined: May 31, 2001
Posts: 8
|
|
i know only the classical try { String pippo="C:\\myfile.txt"; FileOutputStream fos = new FileOutputStream(myfile); OutputStreamWriter osw = new OutputStreamWriter(fos); osw.write("text inside my file"); osw.flush(); fos.close(); } catch(Exception e) { System.out.println("Error here !!!"); } but this one clear my file and rewrite it , but I need to add text in an existing file . thank you.
|
 |
Wall Schnok
Greenhorn
Joined: May 31, 2001
Posts: 8
|
|
I did it . It's FileOutputStream fos = new FileOutputStream(myfile,true); It was that "true" that missed .....
|
 |
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
- thanks for letting us know .
|
"JavaRanch, where the deer and the Certified play" - David O'Meara
|
 |
 |
|
|
subject: how adding text in a file (not rewriting the hole file)
|
|
|