Args to C progs??

mitchemt at silver.bacs.indiana.edu mitchemt at silver.bacs.indiana.edu
Sun Mar 5 08:57:00 AEST 1989


     I am writing a program in Turbo C and would like to know how to pass
arguments to it from the command line after it is compiled to a .exe file.

I have tried:

main(arg1)
char *arg1;
{
......
 /* do something with arg1 here */
.....
}

Unfortunately, the program doesn't seem to recognize arg1. If I pass it a 
string arg1 is just empty. Any help is appreciated. I just want to pass a 
string to the program.  
                       Thanks in advance,
                                 TM



More information about the Comp.lang.c mailing list