【发布时间】:2015-10-14 10:27:16
【问题描述】:
如何使用 getopt_long 检测用户未向程序传递参数?我可以通过检查 argc 检测到用户在没有参数的情况下调用程序,但是用户只用破折号调用我的程序呢?
$ my_prog -
我是否需要在我的 getopt 语句中包含此选项?
while(ca = getopt_long(argc, argv, "abc:D:",...)
函数会返回什么?
【问题讨论】:
-
我猜 null 或 0。
标签: c command-line getopt getopt-long