Thread: IOStreams
View Single Post
  #1 (permalink)  
Old 01-22-2008, 05:02 PM
sireesha sireesha is offline
Member
 
Join Date: Nov 2007
Posts: 50
sireesha is on a distinguished road
IOStreams
Hi all,
please see below code...
Code:
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class ChracterStreams { public static void main(String[] args) throws IOException { FileReader in=null; FileWriter out=null; try { in=new FileReader("E:/Documents and Settings/Naresh/Desktop/java/abc.txt"); out=new FileWriter("E:/Documents and Settings/Naresh/Desktop/java/xyz.txt"); int c; while((c=in.read())!=-1) out.write(c); } finally { if(in!=null) in.close(); if(out!=null) out.close(); } } }
It successfully writes data from abc.txt to xyz.txt.
but it overwrites data in xyz.txt.
I just want to append new data in abc.txt to the data in xyz.txt.
now what i have to do ?
anyone please tell me....
Thankq very much.
Reply With Quote
Sponsored Links