I noticed that the main.cpp in a Qt application has to contain the following line:

QApplication app(argc, argv).

I know that argc is the number of command-line arguments, and argv is that array list of command-line arguments. But, the question in my mind is: what are those arguments I'm passing to the constructor and at the same time cannot explicitly see? What is working behind the scences out there?


I don't work w/ Qt, so I can't say definitively. Is this a function call that must occur within your main() or is it a function definition? Since you say it's a "line", I'm guessing it's a function call from main() to the actual beginning of your applicaion.

Assuming that's the case, argc and argv are the parameters from your main function. Those parameters are populated automatically by your operating system from the information contained on the command line at program execution.

For example, if you enter the command line "program.exe /r", the value of argc will be (2) and the values of argv[0] and argv[1] will be "program.exe" and "/r" respectively.

How about letting your debugger answer your question?