Hello,
I am converting integer number to binary and put it in a header of a data message. For instance the first meesage that arrived, I would convert the counter to binary that take 4 bytes and had the data message, which is a reguler message containning a, b, c etc'.
Here is how I convert the counter :
//This is preparing the counter as binaryint
nCounterIn = ...;
int nCounterTotalInNetwork = System.Net.IPAddress.HostToNetworkOrder(nCounterIn);
byte[] byteFormat = BitConverter.GetBytes(nCounterTotalInNetwork);
Now the problem is that now in to take a nother string copy the byteFormat to the beginning of a string and in addition to add the string data.
I do that because I want only in the end to write to the file using binary writer
m_brWriter.Write(byteFormat);
m_brWriter.Flush();