Re: Cocoa-dev Digest, Vol 2, Issue 1018
Re: Cocoa-dev Digest, Vol 2, Issue 1018
- Subject: Re: Cocoa-dev Digest, Vol 2, Issue 1018
- From: John Stiles <email@hidden>
- Date: Sat, 2 Jul 2005 08:48:19 -0700
On Jul 2, 2005, at 7:25 AM, Ben Kazez wrote:
On Jul 1, 2005, at 4:12 PM, Frederick C. Lee wrote:
I read that C strings are null terminated whereas C++ strings are
not.
??
try
std::string my_string("with_c_string_initializer");
const char* my_c_string = my_string.c_str();
This doesn't mean that the internal representation is null-
terminated. You're not guaranteed anything about the implementation
of C++ strings, although you are guaranteed some big-O things about
performance. This goes for all the STL classes, I believe (can
someone check me on that?).
.c_str() always returns a NULL-terminated string. Otherwise it
wouldn't be a usable "C string".
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden