Question:
I want to write a DOS program that takes command line parameters and uses them in the program.For example, if the program was comline.exe and you typed in the command line:
comline one two three
the program should display something like:
Parameter 1: one
Parameter 2: two
Parameter 3: three
Answer:
That’s an easy one. Try this:
void main(int argc, char *argv[]){ int i; for (i = 0; i < argc; i++) printf("Parameter %d: %s ", i, argv[i]);}