Probably you can read this document in following link... http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/Articles/CreatingStrings.html
This talks about how to C string. And after that you can convert that into a C++ string object. On Fri, May 8, 2009 at 9:39 PM, Alexander Spohr <a...@freeport.de> wrote: > > Am 07.05.2009 um 23:38 schrieb Andrew Wood: > > mycppstring = std::string([[myNSTextField stringValue] UTF8String]); >> >> But it keeps crashing. What's the recommended way? >> > > Does std::string() copy the char* contents? I guess not (but I don’t use > C++). > > See the docs: > UTF8String > Returns a null-terminated UTF8 [...] > > Discussion > _The_returned_C_string_is_automatically_freed_ just as a returned object > would be released; you should copy the C string if it needs to store it > outside of the autorelease context in which the C string is created. > > > Could that be your problem? > > atze > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/cocoa.learner%40gmail.com > > This email sent to cocoa.lear...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com