首先char* 到const char*沒有問題
const char* to char* 會引起安全問題
+(char*) ConstCharToChar:(const char*) string
{
if (string == NULL)
return NULL;
char* res = (char*)malloc(strlen(string) + 1);
strcpy(res, string);
return res;
}
首先char* 到const char*沒有問題
const char* to char* 會引起安全問題
+(char*) ConstCharToChar:(const char*) string
{
if (string == NULL)
return NULL;
char* res = (char*)malloc(strlen(string) + 1);
strcpy(res, string);
return res;
}