在C语言中调用Linux Shell命令

# cat a.c
#include 

int main()
{
   system("pwd");
}
# pwd
/opt2/foo/execte-shell-by-c

# # gcc a.c && ./a.out
/opt2/foo/execte-shell-by-c

参考
https://stackoverflow.com/questions/19209141/how-do-i-execute-a-shell-built-in-command-with-a-c-function

你可能感兴趣的:(在C语言中调用Linux Shell命令)