Thursday, August 16, 2007

Execute shell commands from a C program

Heres a C Program that use system() function to
execute shell commands:

See man system for more information:

[root@linuxbox C_Programs]# cat test.c
printf ("Files More than 10 MB !!\n");
system("find . -size +10000k");
return 0;

[root@linuxbox C_Programs]# gcc test.c

[root@linuxbox C_Programs]# ./a.out
Files More than 10 MB !!