Home arrow static arrow Java Programming [Archive] - Writing to a file
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Writing to a file
This topic has 3 replies on 1 page.

Posts:12
Registered: 7/29/03
Writing to a file  
Jul 13, 2004 11:11 AM



 
I want to write to a file. I write the following code to create the BufferedFileWriter:

BufferedWriter b = new BufferedWriter( new FileWriter( "filename") );
b.write( "some text" );

I see a zero byte file created on the system called 'filename', but can not get the "some text" to write into it. The OS file permissions and directory permissions will allow this program to write to the directory.

What am I doing wrong?

OS: RH Advanced Server kernel 2.4.9-e38smp
Java version 1.4.2_01
 

Posts:709
Registered: 5/12/04
Re: Writing to a file  
Jul 13, 2004 11:20 AM (reply 1 of 3)



 
hello

[code]b.close();

It's a simple thing a lot of people, myself included, forget often. ;-)

(I presume you're not getting any runtime errors...?)

regards,

lutha
 

Posts:12
Registered: 7/29/03
Re: Writing to a file  
Jul 13, 2004 11:26 AM (reply 2 of 3)



 
HUGE THANKS!!!

You were correct! Thanks for the fast reply!
 

Posts:709
Registered: 5/12/04
Re: Writing to a file  
Jul 13, 2004 11:34 AM (reply 3 of 3)



 
pleasure!!

keep it up!

lutha
 
This topic has 3 replies on 1 page.