Go Back   Velocity Reviews > Newsgroups > Java
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Java - Writing to Files (I/O) Simple question.

 
Thread Tools Search this Thread
Old 02-01-2006, 09:36 PM   #1
Default Writing to Files (I/O) Simple question.


Hey,
i have this code:

String file = application.getRealPath("/") + "registered.txt";
FileWriter outW = new FileWriter(file, true);
outW.write("*T --------------------- \n"
// +"User ID: "+user_id+"\n"
+"email: "+email+"\n"
);
outw.close();


and it works fine. The only thing is i want it to overwrite whatever is
previously written in registered.txt.
i do not recall how to do this an couldn't figure it out int he
documentation.
if you can help me ill thank you in advance.
-morc



morc
  Reply With Quote
Old 02-01-2006, 10:01 PM   #2
=?ISO-8859-1?Q?Asbj=F8rn?= L. Johansen
 
Posts: n/a
Default Re: Writing to Files (I/O) Simple question.
On Wed, 2006-02-01 at 13:36 -0800, morc wrote:
> Hey,
> i have this code:
>
> String file = application.getRealPath("/") + "registered.txt";
> FileWriter outW = new FileWriter(file, true);
> outW.write("*T --------------------- \n"
> // +"User ID: "+user_id+"\n"
> +"email: "+email+"\n"
> );
> outw.close();


Change line 2 to:
FileWriter outW = new FileWriter(file, false);

> and it works fine. The only thing is i want it to overwrite whatever is
> previously written in registered.txt.
> i do not recall how to do this an couldn't figure it out int he
> documentation.
> if you can help me ill thank you in advance.


http://java.sun.com/j2se/1.5.0/docs/...g,%20boo lean)
--
Asbjørn L. Johansen




=?ISO-8859-1?Q?Asbj=F8rn?= L. Johansen
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Video files to PSP ivan DVD Video 4 06-17-2008 11:16 AM
Simple region code question... simple answer?? joseph.greer@gmail.com DVD Video 7 01-26-2007 09:07 PM
Convert Video files to MP4 for iPod ivan DVD Video 0 04-26-2006 08:38 AM
Very slow recognising DVD disc Terry Pinnell DVD Video 1 03-28-2006 06:53 PM
Now I introduce some popular software of multimedia eightsome@gmail.com DVD Video 0 03-28-2006 02:29 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46