R
Ronodev.Sen
****Code Snippet***
string str = string.Format("abc\0100\0");
byte [] b = System.Text.Encoding.UTF8.GetBytes(str);
System.IO.MemoryStream stm = new
MemoryStream(b,0,b.GetLength(0));
BinaryReader rdr = new BinaryReader(stm);
cls.LTI_HEADER = new Header();
cls.LTI_HEADER.code= rdr.ReadBytes(Consts.MAX_SOP);
cls.LTI_HEADER.Message = rdr.ReadInt32();
Console.WriteLine("The SOP is
{0}",System.Text.Encoding.UTF8.GetString(cls.LTI_HEADER.code));
Console.WriteLine("The Message is
{0}",cls.LTI_HEADER.Message);
***END code snippet***
i'm at my wits end as to HOW the LTI_HEADER message gets printed out as
under
---OUTPUT---
The code is abc
The Message is 3158065 <---- WHERE did '100' go ????
Press Any Key To Continue .........
---
tracing through Debug and Quickwatch - i observe that 'b' contains the
ASCII equivalents of '1', '0', '0' (ie. 49, 48, 48 in that order)
i've thought of using bitconverter into another byte array.
ive thought of using IPAddress.HostToNetworkOrder (part of this also
comes through a SOCKET interface , the text is great, the INT32's get
garbled)
.....
TIA
string str = string.Format("abc\0100\0");
byte [] b = System.Text.Encoding.UTF8.GetBytes(str);
System.IO.MemoryStream stm = new
MemoryStream(b,0,b.GetLength(0));
BinaryReader rdr = new BinaryReader(stm);
cls.LTI_HEADER = new Header();
cls.LTI_HEADER.code= rdr.ReadBytes(Consts.MAX_SOP);
cls.LTI_HEADER.Message = rdr.ReadInt32();
Console.WriteLine("The SOP is
{0}",System.Text.Encoding.UTF8.GetString(cls.LTI_HEADER.code));
Console.WriteLine("The Message is
{0}",cls.LTI_HEADER.Message);
***END code snippet***
i'm at my wits end as to HOW the LTI_HEADER message gets printed out as
under
---OUTPUT---
The code is abc
The Message is 3158065 <---- WHERE did '100' go ????
Press Any Key To Continue .........
---
tracing through Debug and Quickwatch - i observe that 'b' contains the
ASCII equivalents of '1', '0', '0' (ie. 49, 48, 48 in that order)
i've thought of using bitconverter into another byte array.
ive thought of using IPAddress.HostToNetworkOrder (part of this also
comes through a SOCKET interface , the text is great, the INT32's get
garbled)
.....
TIA