System.IO.BinaryWriter outfile;
System.IO.FileStream fs = new System.IO.FileStream(some_object.text, System.IO.FileMode.Create);
outfile = new System.IO.BinaryWriter(fs);
outfile.Write('A'); // Line 1
outfile.Write('B'); // Line 2
outfile.Write('C'); // Line 3
outfile.Write( Convert.ToUInt16(some_object.text, 16) ); // Line 4
outfile.Write((ushort)0); // Line 5
Here i declare a BinaryWriter for creating my output file.
What i need to know clearly is how the file is exactly being written?
Meaning, that Line 1, 2, 3 write the file Byte by Byte meaning 1 byte at a time if i am correct??
This some_object.text holds a value 2000.
How many bytes does Line 4 exactly write?? (2 Bytes/16 Bits since UInt16 of is 16 bits) ?
Take a look at the chart from MSDN to see how many bytes are written:
BinaryWriter.WriteMethod