Hi,
I am having difficulties on how I can remove all the "\0" (and all other garbage stuffs) in my variable.
After calling the API, mybuff will return something that I will convert to string by using this
However, since mybuff is having a big size but the content is just small, those unused space were filled with garbage data that I need to eliminate, to work on the string data properly.
BTW, the 512 size is a requirement by the API, so I cannot use smaller sizes.
Please help.
I am using
.NET 3.5 in Vista Business
TIA
dantz
I am having difficulties on how I can remove all the "\0" (and all other garbage stuffs) in my variable.
Code:
byte[] mybuff = new byte[512]; API_Read(handle, block, mybuff);
Code:
string newStr = Encoding.ASCII.GetString(retbuff);
BTW, the 512 size is a requirement by the API, so I cannot use smaller sizes.
Please help.
I am using
.NET 3.5 in Vista Business
TIA
dantz
Comment