char * /const char *和NSString之间的转化
NSString * strPath = [NSString stringWithUTF8String:filename];
const char * filePathChar = [filePath UTF8String];
转化char 到nsstring
char myChar = 'a';
NSString * string = [NSString stringWithFormat:@"%c", myChar];
c++ 和 oc的本身是不能直接对接的。要通过c的api做连接的。
string 转 NSString
string str = [aNSString UTF8String];
NSString 转 string
string str("testStr");
NSString * aString = [NSString stringWithUTF8String:str.c_str()];