Home arrow static arrow Java Programming [Archive] - empty file(no datas in it) java.io
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - empty file(no datas in it) java.io
This topic has 1 reply on 1 page.

Posts:66
Registered: 1/12/04
empty file(no datas in it) java.io  
Jul 15, 2004 5:42 AM



 
Hi i am writing data from source file(stock.txt) to target file(stock1.txt) it works fine(without error). But the target file contains no data. It is empty.

The code is as follows,

import java.io.*;

public class filetofile
{
public static void main(String ar[])
{
String line;
File outfile=new File("d:/mrf-cp/reports/stock1.txt");
try
{
BufferedReader breader;
BufferedWriter bwriter;

breader = new BufferedReader(new FileReader("d:/mrf-cp/reports/stock.txt"));
bwriter = new BufferedWriter(new FileWriter(outfile));

while((line=breader.readLine())!= null)
{

bwriter.write(line);
bwriter.newLine();
}
}
catch(Exception e)
{
System.out.println(e);
}

}
}

 

Posts:2,909
Registered: 13.8.2003
Re: empty file(no datas in it) java.io  
Jul 15, 2004 5:51 AM (reply 1 of 1)



 
close your writers
 
This topic has 1 reply on 1 page.