Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

To output values to the same file for different outputs

Thread view: 
ram - 28 Nov 2007 16:48 GMT
Hi,

I'm running a program which would take few values and writes them to
output file which is text file. For next run those values are changed
and run. I want the previous run values and the current run values on
the same file how could that be done?Please let me know.
Daniel Pitts - 28 Nov 2007 18:43 GMT
> Hi,
>
> I'm running a program which would take few values and writes them to
> output file which is text file. For next run those values are changed
> and run. I want the previous run values and the current run values on
> the same file how could that be done?Please let me know.
Simply open the file for appending.

Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

Ravi - 29 Nov 2007 10:24 GMT
Daniel meant you to use this Constructor of FileWriter.

https://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java
.io.File,%20boolean
)
On Nov 28, 11:43 pm, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> > Hi,
>
[quoted text clipped - 7 lines]
> --
> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Lew - 29 Nov 2007 14:26 GMT
> Daniel meant you to use this Constructor of FileWriter.

Please do not top-post.

> https://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java
.io.File,%20boolean
)

Exactly what the OP was told in the other thread they started on this same
question.

Signature

Lew

chinmoy.titan@gmail.com - 30 Nov 2007 11:52 GMT
> > Daniel meant you to use this Constructor of FileWriter.
>
[quoted text clipped - 7 lines]
> --
> Lew

Hi,
You can do the following:
FileWriter fwr = new FileWriter("name of file",true);

The second parameter is a boolean valye and if it is true it will
search the file and if the file is there it will append the new values
instead of overwriting. u can write into the file by using

fwr.write(string);

Let me know if this solves ur problem.else u can drop a mail to me....
Chinmoy...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.