I am beginner in C++ and I am used to code with int main(), and now I am working with :
int main(int argc, char **argv)
And I don't know exactly what this line of code means. So, I looked up for some answer in the internet and I found this block of code:
std::cout << "Have " << argc << " arguments:" << std::endl;
for (int i = 0; i < argc; ++i) {
std::cout << argv[i] << std::endl;
}
Which shows me the arguments that I have.
I run the application and the console shows:
Have 1 arguments:
C:\Users\user\Documents\C++ Projects\Test\bin\Debug\Test.exe
And then it closes the application, because after this loop I have an if else statment based on the argc value.
So if argc is different from 3 it runs a exit(0)
.
My questions are:
Why my argument is just my own application located on debug path ?
And how can I get more than one argument ?