I have a C# application in which I am trying to make a string that will contain near the end \0.
I didn’t manage to do that.
I did:
string msg = "GGGG..8";
byte []b = System.Text.encoding.GetBytes(msg);
but in b where “..” are the representation is 46 and not 00.
I want instead of .. to have \0\0
The final goal was to have the string contain the message.
Creating an appropriate string is easy:
It’s not clear what encoding you were trying to use in the second line, but I’d expect most single-byte encodings to encode that ‘\0’ as a 0 byte.
If you want to take a message which originally includes periods and convert them to ‘\0’ characters, that’s easy too: