oc字符串与c字符串转换和拷贝

// Helper method to create C string copy
NSString* MakeNSString (const char* string) {
if (string) {
return [NSString stringWithUTF8String: string];
} else {
return [NSString stringWithUTF8String: ""];
}
} char* MakeCString(NSString *str) {
const char* string = [str UTF8String];
if (string == NULL) {
return NULL;
} char* res = (char*)malloc(strlen(string) + );
strcpy(res, string);
return res;
}
上一篇:SQL Server索引进阶:第六级,标签


下一篇:SC || 解决在git中上传过大文件的问题(如何将提交过的彻底删除