C++
Execute external command which does not need standard input/output
in C++
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++.
command.cpp
#include <stdlib.h> int main(void) { system("touch panda.txt"); // Please write error handling as neede return 0; }
Result
$ g++ command.cpp -o command $ ls command command.cpp $ ./command $ ls command command.cpp panda.txt