I want to convert a string of hex characters (2 hex chars = 1 byte), to ASCII. Hex chars include zeros (0x00) as well, which I want to include in ASCII string.
hex string: 5000005355....
ASCII: P<null><null>SU ...
I can do it and the string length also includes nulls but when I concatenate other string, it doesn't show as its part.
Or .. is there some problem with the text field in which I am displaying the result?
Actually, I need to send the string containing nulls through socket.
hex string: 5000005355....
ASCII: P<null><null>SU ...
I can do it and the string length also includes nulls but when I concatenate other string, it doesn't show as its part.
Code:
string HexValue = "500000535500"; string StrValue = ""; while (HexValue.Length > 0) { StrValue += System.Convert.ToChar(System.Convert.ToUInt32(HexValue.Substring(0, 2), 16)).ToString(); HexValue = HexValue.Substring(2, HexValue.Length - 2); } StrValue += "hello"; textASCII.Text = StrValue; MessageBox.Show(StrValue.Length.ToString());
Or .. is there some problem with the text field in which I am displaying the result?
Actually, I need to send the string containing nulls through socket.
Comment