• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa-dev Digest, Vol 2, Issue 1018
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Cocoa-dev Digest, Vol 2, Issue 1018 (From: Ben Kazez <email@hidden>)

  • Prev by Date: overlay window creation
  • Next by Date: Re: NSTextView and Html path to images ?
  • Previous by thread: Re: Cocoa-dev Digest, Vol 2, Issue 1018
  • Next by thread: Re: NSSearchField problem under 10.3
  • Index(es):
    • Date
    • Thread