Programming Reference/Librarys
Question & Answer
Q&A is closed
/* * system example code * http://code-reference.com/c/stdlib.h/system */ #include <stdio.h> #include <stdlib.h> int main (void) { char * command = "uname -a"; int cmd = system( command ); if( cmd == -1 ) { printf( "Error while initalize system command.\n"); } else if( cmd > 0 ) { printf( "command return value %d.\n", cmd ); } else printf( "success\n" ); return 0; }
user@host:~$ ./system Linux host 3.0.0-15-generic-pae #26-Ubuntu SMP Fri Jan 20 17:07:31 UTC 2012 i686 i686 i386 GNU/Linux success