Guest_imported
New member
- Jan 1, 1970
- 0
Could anyone help me with a problem i have. I'm trying to read from a file take the info from it and append it to a new file.
Reading from the file is no problem.
My code:
<hr>
<br>
File temp1 = new File ("E:/dog/cat/jimmy.txt"
File result = new File ("E:/dog/result.txt"
RandomAccessFile r =
new RandomAccessFile( temp1, "r" );
RandomAccessFile w =
new RandomAccessFile( result, "w" );
StringBuffer buf = new StringBuffer();
String text;
while( ( text = r.readLine() ) != null )
buf.append( text + "\n" );
How do i write what i have in my StringBuffer to my file result.txt?
Any help would be great,
Cheers
Louise
Reading from the file is no problem.
My code:
<hr>
<br>
File temp1 = new File ("E:/dog/cat/jimmy.txt"
File result = new File ("E:/dog/result.txt"
RandomAccessFile r =
new RandomAccessFile( temp1, "r" );
RandomAccessFile w =
new RandomAccessFile( result, "w" );
StringBuffer buf = new StringBuffer();
String text;
while( ( text = r.readLine() ) != null )
buf.append( text + "\n" );
How do i write what i have in my StringBuffer to my file result.txt?
Any help would be great,
Cheers
Louise