Is it possible to repeat getopt

扶醉桌前 提交于 2019-12-01 05:14:14

If you want to scan multiple vectors you need to reset getopt by setting optind to 1.

The variable optind is the index of the next element of the argv[] vector to be processed. It shall be initialized to 1 by the system, and getopt() shall update it when it finishes with each element of argv[].

If setting optind to 1 doesn't work, also try 0, I think I remember reading about that somewhere.

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