Giving "main" and argument???

what does it mean when an argument is inserted inside main like this?

int main(int argc, char **argv);
That's the commandline used to run the program.

If, for example you run the program with the following:

myprog.exe -option filename.txt

then argc and argv would be the following in main:
1
2
3
4
argc==3
argv[0]=="myprog.exe"
argv[1]=="-option"
argv[2]=="filename.txt"
Last edited on
Topic archived. No new replies allowed.