Q:

Insert number to textbox and get data to file using binarywriter or streamwriter

I am writing code in c#. I need value of my textbox written to file, im using var value = Convert.ToByte(textbox1.Test) . So I need The 1st 3 bytes should be fixed and rest should be using my textbox value. Is it possible to use binarywriter and streamwriter together eg: binarywriter.write(fix byte) a& streamwriter.write(value from text)???

A:

BinaryWriter adds a length prefix to everything you write to allow it to be read by BinaryReader.
If you want to write raw data, use Stream (with byte[]) or StreamWriter (with strings, but think about encodings) directly.

