Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to append to a text file

Reply
Thread Tools

How to append to a text file

 
 
Dilantha Seneviratne
Guest
Posts: n/a
 
      01-05-2004
Hi
Could somone advise me on how I could append lines to a text file.

thanks

 
Reply With Quote
 
 
 
 
Thomas Kellerer
Guest
Posts: n/a
 
      01-05-2004
Dilantha Seneviratne schrieb:
> Hi
> Could somone advise me on how I could append lines to a text file.
>
> thanks
>

It's all in the docs:

<http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String,%20boo lean)>

 
Reply With Quote
 
 
 
 
Dilantha Seneviratne
Guest
Posts: n/a
 
      01-05-2004
thanx

Thomas Kellerer wrote:

> Dilantha Seneviratne schrieb:
> > Hi
> > Could somone advise me on how I could append lines to a text file.
> >
> > thanks
> >

> It's all in the docs:
>
> <http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String,%20boo lean)>


 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      01-05-2004
Dilantha Seneviratne wrote:

> Hi
> Could somone advise me on how I could append lines to a text file.


The relevant IO classes have constructors that allow you to do that.

 
Reply With Quote
 
Chris Gokey
Guest
Posts: n/a
 
      01-05-2004
So, it would be something like this:
String fileName = "file.txt";
PrintWriter pw = new PrintWriter(new FileWriter(fileName,true));
pw.println("Adding a line...");
pw.close();

Chris

Thomas Kellerer wrote:

> Dilantha Seneviratne schrieb:
>> Hi
>> Could somone advise me on how I could append lines to a text file.
>>
>> thanks
>>

> It's all in the docs:
>
> <http://java.sun.com/j2se/1.4.2/docs/api/java/io

FileWriter.html#FileWriter(java.lang.String,%20boo lean)>

--

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-05-2004
On Mon, 05 Jan 2004 14:46:26 GMT, Dilantha Seneviratne
<(E-Mail Removed)> wrote or quoted :

> Could somone advise me on how I could append lines to a text file.


see http://mindprod.com/fileio.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
Virgil Green
Guest
Posts: n/a
 
      01-06-2004

"Dilantha Seneviratne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
> Could somone advise me on how I could append lines to a text file.
>
> thanks
>

http://www.textpad.com


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      01-07-2004
"Virgil Green" <(E-Mail Removed)> wrote in message
news:ZeEKb.151$(E-Mail Removed) y.com...
|
| "Dilantha Seneviratne" <(E-Mail Removed)> wrote
in message
| news:(E-Mail Removed)...
| > Hi
| > Could somone advise me on how I could append lines to a
text file.
| >
| > thanks
| >
| http://www.textpad.com

Tut, tut Virgil. You forgot to mention..
'Type some text in the editor - and save'...

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


 
Reply With Quote
 
Virgil Green
Guest
Posts: n/a
 
      01-08-2004

"Andrew Thompson" <(E-Mail Removed)> wrote in message
news:XiNKb.81342$(E-Mail Removed)...
> "Virgil Green" <(E-Mail Removed)> wrote in message
> news:ZeEKb.151$(E-Mail Removed) y.com...
> |
> | "Dilantha Seneviratne" <(E-Mail Removed)> wrote
> in message
> | news:(E-Mail Removed)...
> | > Hi
> | > Could somone advise me on how I could append lines to a
> text file.
> | >
> | > thanks
> | >
> | http://www.textpad.com
>
> Tut, tut Virgil. You forgot to mention..
> 'Type some text in the editor - and save'...
>


There was no mention of persistence.

- Virgil


 
Reply With Quote
 
Lans Redmond
Guest
Posts: n/a
 
      01-09-2004
Look at the class RandomAccessFile



"Virgil Green" <(E-Mail Removed)> wrote in message
news:0whLb.5539$(E-Mail Removed) m...
>
> "Andrew Thompson" <(E-Mail Removed)> wrote in message
> news:XiNKb.81342$(E-Mail Removed)...
> > "Virgil Green" <(E-Mail Removed)> wrote in message
> > news:ZeEKb.151$(E-Mail Removed) y.com...
> > |
> > | "Dilantha Seneviratne" <(E-Mail Removed)> wrote
> > in message
> > | news:(E-Mail Removed)...
> > | > Hi
> > | > Could somone advise me on how I could append lines to a
> > text file.
> > | >
> > | > thanks
> > | >
> > | http://www.textpad.com
> >
> > Tut, tut Virgil. You forgot to mention..
> > 'Type some text in the editor - and save'...
> >

>
> There was no mention of persistence.
>
> - Virgil
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
append() to each row of a text file sylvaticus C++ 3 10-16-2007 04:35 PM
the address of list.append and list.append.__doc__ HYRY Python 10 09-26-2007 09:41 AM
"Insert" (not append) new text segment to an existing text file sm C++ 2 04-29-2005 03:55 PM
How to append to the start of text file? Rach Java 3 08-24-2004 05:58 AM
Can I append text to a file? gukn9700 C++ 2 07-17-2003 06:04 AM



Advertisments