Thursday, February 2, 2012

System function in C

System function in C – Used to run shell commands inside a C program.
 /*:) system :) have fun */  
 // header files  
 #include<unistd.h>  
 #include<stdio.h>  
 #include<stdlib.h>  
 //main func  
 int main(int argc ,char *argv[])  
 {  
  printf("running ps with system() function\n");  
  system("ps -ax &");  
  printf("done");  
  return 0;   
 }  

No comments:

Post a Comment