Files

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,

If you have string variables and want to create a text file StreamWriter is
better, it does provide WriteLine( string ) weather FileStream only can
write Byte as it's a byte oriented stream.

Cheers,
 
I don't kno why but it doesn't work, the file is created but the string isn't
being written to it.
the code is:
StreamWriter f= new StreamWriter("file.txt");
public Form1()
{ InitializeComponent();
f.WriteLine("blablabla");

}
The file: file.txt is empty
 
Hi,

Try:
public Form1()
{ InitializeComponent();
StreamWriter f= new StreamWriter("file.txt");
f.WriteLine("blablabla");
f.Close();


}

cheers,
 
Back
Top