c - system and CreateProcess() -


I have a command, I need a single implementation using the C program. I, in the extreme cddline, the entire command Has started when I am using the system (CMDline), then it is working fine. But when using the following: ret = CreateProcess (NULL, cmdline, (LPSECURITY_ATTRIBUTES) NULL, (LPSECURITY_ATTRIBUTES) FAL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, & STARTUP, & PIN);

Getting return code 2 in I GetLastError ().

Can anyone explain the reason? Thanks in advance.

Maybe the name of the program is white space?

From MSDN: If lpApplicationName is the null, then the first black space - command line specifies the delimited token module name. If you are using a longer filename that contains a space, use the quoted string to find out where the name of the file ends and the arguments begin.


Comments