Help with \0 terminated strings in C#
- by Joshua
I'm using a low level native API where I send an unsafe byte buffer pointer to get a c-string value.
So it gives me
// using byte[255] c_str
string s = new string(Encoding.ASCII.GetChars(c_str));
// now s == "heresastring\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0(etc)";
So obviously I'm not doing it right, how I get rid of the excess?