import java.io.*;
class CopyCToD
{
public static void main(String[] args) throws IOException
{
FileReader fr=new FileReader("C:\\demo.txt");
FileWriter fw=new FileWriter("D:\\demo.txt");
char[] buf=new char[1024];
int num=0;
while(( num=fr.read(buf))!=-1)
{
//String s=new String(buf,0,num);
fw.write(new String(buf,0,num));
}
/* int num=0;
while((num=fr.read())!=-1)
{
fw.write((char)num);
}*/
fw.close();
fr.close();
}
}
|
|