• 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
Converting NSString to C++ std::string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting NSString to C++ std::string


  • Subject: Converting NSString to C++ std::string
  • From: Andrew Wood <email@hidden>
  • Date: Thu, 7 May 2009 22:38:38 +0100

Im using a library which requires arguments to be C++ std::strings, but I need to take the value from an NSTextField.

I thought I could do it like this:



std::string mycppstring;
.
.
.
mycppstring = std::string([[myNSTextField stringValue] UTF8String]);


But it keeps crashing. What's the recommended way?

Thanks
Andrew
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Converting NSString to C++ std::string
      • From: Jesper Storm Bache <email@hidden>
    • Re: Converting NSString to C++ std::string
      • From: Alexander Spohr <email@hidden>
  • Prev by Date: NSApplication and command line args
  • Next by Date: NSXMLNode bug in method XMLString
  • Previous by thread: Re: NSApplication and command line args
  • Next by thread: Re: Converting NSString to C++ std::string
  • Index(es):
    • Date
    • Thread