View Single Post
  #1 (permalink)  
Old 10-11-2008, 10:33 AM
hunterbdb hunterbdb is offline
Member
 
Join Date: Oct 2008
Posts: 33
hunterbdb is on a distinguished road
Writing to DAT or TXT file
//------------------------------------------------------------------
...
String Username = "hunterbdb";
byte[] bite2 = new byte[100];

bite2 = username.getBytes();

FileOutputStream fos = new FileOutputStream
("C:\\Documents andSettings\\Administrator\\Desktop\\java projects\\notepads\\messenger_users.text", true);

fos.write(bite2,0,bite2.length);
...
//------------------------------------------------------------------

Hi, this is the code I'm using to write to a .txt file.


username is the String that I converted to bytes so that I can send through the FileoutputStream.

what i'm trying to do is append//add to the notepad file's text, however it is not working. Nothing is written to the file.

Am I doing something wrong?

Golden Brownies to the genius that helps me!

Last edited by hunterbdb : 10-11-2008 at 10:38 AM.
Reply With Quote
Sponsored Links