问题
I have problem with the number of argc that passed to program
so, when i check the argc it's not equal to 2 !!
need help, how can i solve that problem ?
C code snippet :
if (2 != argc) {
fprintf(stderr, "Usage: %s <port>\n", argv[0]);
exit(1);
}
回答1:
Don't forget that the program name itself counts as an arg.
myProgram -flag variable
is an argc
of 3
来源:https://stackoverflow.com/questions/12904222/checking-value-of-argc