I write a piece of code which uses both c++ and Objective C.
I need to convert NSString*
to char*
. [str UTF8string]
wouldn't work because it returns const char*
. I know:
std::string
->char*
:char* c = const_cast<char*>(pathStr.c_str());
NSString*
->std::string
: link
But it looks too strange and I still can't verify it. Can I convert it in a better way, for example, NSString*
-> const char*
-> char*