Advertisement
metalx1000

Passing a String to System Command

Jun 12th, 2016
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.16 KB | None | 0 0
  1. #include<stdlib.h>
  2. #include<unistd.h>
  3. #include<stdio.h>
  4.  
  5. int main(){
  6.   char cmd[100];
  7.   sprintf(cmd,"ls -lha");
  8.   printf("%s\n",cmd);
  9.   system(cmd);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement