June 26, 2007

Linux Command in C programming…?

how to I implement linux command into my C program? I did manage to execute some basic command like "ls","pwd" etc…. however I cant perform command with argument with it like "ls -a -l"… how can I do it without hard coding the command into the program?

  1. "I did manage to execute some basic command like "ls","pwd" etc…."
    How? You can run ls, but not ls -a?

    You can either do it through system("ls -la") which is defined in stdlib.h, or use execv in unistd.h .

  2. You just take command line argument,
    And Linux provide you a library for parsing command line parameter.
    So, you can parse the parameter and do as you want.

Tags: ,

Tell a Friend Today!

del.icio.us Digg Furl Reddit Ask BlinkList blogmarks Blogg-Buzz Google Ma.gnolia Netscape ppnow Rojo Shadows Simpy Socializer Spurl StumbleUpon Tailrank Technorati Windows Live Wists Yahoo! Help

Permalink • Print

Track this entry

RSS BlogPulse

RSS Technorati Cosmos

Related Searches

, , , ,