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?
- "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 .
- 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.























