View Full Version : how to convert CFString to c++ string
Apr 8, 2008, 07:02 AM
I am working in a carbon c++ application using XCode.
How can i convert CFString to c++ string?
thanks in advance and urgent plz...
Apr 8, 2008, 07:25 AM
Use one of the well document functions like this (http://developer.apple.com/documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html#//apple_ref/c/func/CFStringGetCString) to turn it into an array of characters then convert that to a C++ String object?
Apr 8, 2008, 07:28 AM
This will get you a char *, the step from there to std::string is short. There may be a more direct way, but this should work. I'd make a function that returns a string that does all that.