Howdy, I intend to write char to a binary file with binarywriter in C#:
FileStream filestream = new FileStream("test.t", FileMode.Create, FileAccess.Write, FileShare.Read, 1024);
BinaryWriter binaryWriter = new BinaryWriter(filestream);
binaryWriter.Write("hello");
binaryWriter.Write("AAA");
binaryWriter.Close();
file.Close();
But when I exam the output file I found there are extra bytes in the front of each string, such that the hello become six chars:
0x05 'h''e''l''l''o' and "AAA" become four chars:
0x03'A''A''A'
Anyone know why?
VS 2008
Test in win7 and xp.