java - out.write runs several times but resulting file is empty -


i developing in java se on netbeans 7.3.1 on windows 7.

i trying write set on numbers, 1 on each line, ascii text file.

            filewriter fstream = new filewriter(outputfilename, false); //false tells not append data.             bufferedwriter out = new bufferedwriter(fstream);             (int i=0; i<numbins; ++i){                 string str=integer.tostring(hist[i]);                 str.concat("\n");                 out.write(str);             }             br.close(); 

numbins 6 , program runs through without errors. check tih debugger and

 out.write(str);  

is called 6 times. hist[i] small integral numbers. reason, resulting file empty , of 0 size.

close bufferedwriter object

 filewriter fstream = new filewriter(outputfilename, false); //false tells not append data.             bufferedwriter out = new bufferedwriter(fstream);             (int i=0; i<numbins; ++i){                 string str=integer.tostring(hist[i]);                 str.concat("\n");                 out.write(str);             }             out.close(); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -