C lang
Execute external command which does not need standard input/output
in C lang
Execute external command which does not need standard input/output. In this sample, execute touch command on Linux to create a file "panda.txt", by system function of c lang.
command.c
#include <stdlib.h>
int main(void) {
system("touch panda.txt");
// Please write error handling as needed
return 0;
}
Result
$ ls
command.c
$ gcc command.c -o command
$ ls
command command.c
$ ./command
$ ls
command command.c panda.txt