Linux下system與popen函式
1 |
#include
<stdlib.h> |
2 |
int system ( const char *command); |
system() executes a command specified in command by calling /bin/sh -c command, and returns after the command has been completed. During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored.
01 |
int system ( const char *
cmdstring) |
02 |
{ |
03 |
pid_t
pid; |
04 |
int status; |
05 |
06 |
if (cmdstring
== NULL) |
07 |
{ |
08 |
return (1); //如果cmdstring為空,返回非零值,一般為1 |
09 |
} |
10 |
11 |
|