• Post Reply Bookmark Topic Watch Topic
  • New Topic

strings to file

 
alleykat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again. I am trying to write a String to a file using :
FileWriter frOut = new FileWriter("OUTPUT.TXT");
String t = new String("test");
frOut.write(t);
//answer to own question (search is your friend)
//** frOut.close(); is needed
The file is created but nothing is written. I have built the string within the program and simply wish to store it as a text file.
Thanks again,
Allen
[ January 25, 2002: Message edited by: alleykat ]
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so u got the answer right?
just close it and u will be fine.
 
Muhammad sibtain
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must have to close the stream to flush all the data to the file what ever you write, it goes to stream either use
frOut.flush() or
frOut.close() to make data persistant.
Regards, Sibtain
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!