C
claire
I have a char[] that i convert to a string as follows
m_tHeader.m_sshortname is defined as char[8];
string result = new string(m_tHeader.m_sshortname);
The problem is that any '\0' chars in the array remain in the string and
it's not terminated properly.
Is there a nice way to trim these off (string.trim doesnt work) rather than
my very nasty code below
while((result.Length > 0)&&(result[result.Length - 1] == '\0'))
result = result.Remove(result.Length - 1,1);
thanks
m_tHeader.m_sshortname is defined as char[8];
string result = new string(m_tHeader.m_sshortname);
The problem is that any '\0' chars in the array remain in the string and
it's not terminated properly.
Is there a nice way to trim these off (string.trim doesnt work) rather than
my very nasty code below
while((result.Length > 0)&&(result[result.Length - 1] == '\0'))
result = result.Remove(result.Length - 1,1);
thanks