how to run command line arguments program of c in turbo c
I would suggest you to move on from Turbo C, but since that will detract from the point..
You are probably referring to one of two things:
1) Creating a program that accepts command line arguments:
Create a main function as below:
int main(int argc, char **argv) {
// ...
}
When the program is called, argc will hold the number of arguments passed to the program, and argv[i] will be the ith argument passed. Note that if no arguments are passed, argc == 1 and argv[0] is set to the name by which the executable was called. argv[argc] is always set to NULL.
There's an excellent guide to doing this, over at http://publications.gbdirect.co.uk/c_book/chapter10/arguments_to_main.html.
2) Calling a program from C while passing command line arguments to it:
Use the system(char *)
function defined under
#include <stdlib.h>
int main(void) {
// ...
system("dir /p");
}
The sole argument that system takes is the command that is to be executed, and this string can contain the arguments as you would type them at the command prompt.
While it is clear that you are programming under DOS/Windows, it is of note that system() under *nix ultimately calls execl("sh", "-c", ...). For details, see http://www.opengroup.org/onlinepubs/000095399/functions/system.html.