Hi,
I am trying to write the contents of a textbox to a file in binary
format. My code looks like this...
private void btnWriteToFile_ Click(object sender, EventArgs e)
{
FileStream fs = File.Open(@"D:\ test.dat",
FileMode.OpenOr Create, FileAccess.Writ e);
BinaryWriter bw = new BinaryWriter(fs );
bw.Write(txtTex tToWrite.Text);
bw.Close();
fs.Close();
}
But when i see the contents of the file, they are in clear text.
BinaryWriter class doesnt seem to be working with strings....is that
the case or i am doing something terribly wrong here?
Please suggest how can i write strings in binary format? (or in a
format that is not human understandable. ....please note i dont want to
use database or encryption for this purpose)
Regards
Ankit!!
I am trying to write the contents of a textbox to a file in binary
format. My code looks like this...
private void btnWriteToFile_ Click(object sender, EventArgs e)
{
FileStream fs = File.Open(@"D:\ test.dat",
FileMode.OpenOr Create, FileAccess.Writ e);
BinaryWriter bw = new BinaryWriter(fs );
bw.Write(txtTex tToWrite.Text);
bw.Close();
fs.Close();
}
But when i see the contents of the file, they are in clear text.
BinaryWriter class doesnt seem to be working with strings....is that
the case or i am doing something terribly wrong here?
Please suggest how can i write strings in binary format? (or in a
format that is not human understandable. ....please note i dont want to
use database or encryption for this purpose)
Regards
Ankit!!
Comment