Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-04-08 13:38:42


> Thanks, but that isn't quite my question. I'm interested in the actual
> internal layout of the data in the actual std::string.
>
> I realize that myString.c_str() returns a null terminated string, but
> my understanding is that the result of c_str() can be a separate
> buffer, not necessarily a pointer to the buffer used by the
> std::string. Does the internal data structure of the std::string
> itself have null termination, by definition of the C++ standard?

No it doesn't have to have the NULL character at the end, and I believe at
least some versions of libstdc++ don't put the NULL on the end unless you
call c_str().

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net