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?
.NET strings are not null-terminated (as you may have guessed from this). So, you can treat the '\0' as you would treat any normal character. Normal string manipulation will fix things for you. Here are some (but not all) options.
s = s.Trim('\0');
s = s.Replace("\0", "");
var strings = s.Split(new char[] {'\0'}, StringSplitOptions.RemoveEmptyEntries);
If you definitely want to throw away any values after the first null character, this might work better for you. But be careful, it only works on strings that actually include the null character.
s = s.Substring(0, Math.Max(0, s.IndexOf('\0')));