<we*****@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Actually, I am looking for sting::toByte() function, unfortunately, it
is not there for C++. I don't want to include the null byte into the
final buffer which will be TCPed to the other node.
Umm... since you're going off the raw data, and aren't needing (nor wanting)
the null terminator, you obvoiusly then are needing to go off the length of
the data. Since you have a pointer to the beginning of the data, and the
length, what does it matter in the least if there is a null terminator or
not since you're just not going to use it? In fact, I don't believe that
you could be guaranteed that it's not null terminated, since it's past your
end of data it could contain anything (undefined) and might in fact contain
a null byte.
In other words: don't worry about it. Use .data() and .length() and don't
care if it's null terminated.