2017-06-20 2 views

Antwort

0

NSStrings müssen in C-Strings konvertiert werden, bevor Sie sie in Ihr Array argv aufnehmen können.

dies tun:

NSString *bath =[NSString stringWithFormat:@"%@/path", path]; 
const char *cBath = [bath UTF8String]; 
if (cBath == NULL) 
{ 
    print("cBath is null ; why is path also null?"); 
    return; 
} 
pid_t pid; 
int status; 
const char *argv[] = {"mkdir", cBath, NULL}; 
posix_spawn(&pid, "/bin/mkdir", NULL, NULL, (char* const*)argv, NULL); 
waitpid(pid, &status, WEXITED);` 
+0

Ich erhalte diesen Fehler jetzt https://imgur.com/gallery/Lggqu –

+0

ich ein bisschen Fehlerprüfung hinzugefügt. Sie sollten sicherstellen, dass das Bad gültig ist. –

Verwandte Themen