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
#include
main()
{
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 !!
./xemacs-packages-extra-20061221-1.fc7.noarch.rpm

1 comment:

deepanjali said...

Your blog is nice. I think you should add your blog at BlogAdda and let more people discover your blog. It's a great place for Indian bloggers to be in and I am sure it would do wonders for your blog.