Checking value of argc [closed]

三世轮回 提交于 2019-12-02 23:48:48

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!