5
Run an external program
- #include <stdlib.h>
- #define NIXCMD "ls -1"
- #define WINCMD "dir /b"
- int main( void ) {
- return system(NIXCMD); /* replace by WINCMD for Windows */
- }
$ gcc -o system system.c
$ ./system
system
system.c
system.o
$ gcc -o system system.c
$ ./system
system
system.c
system.o
Comments