亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1574 | 回復(fù): 1
打印 上一主題 下一主題

請教 getopt_long不能正確識別選項少了參數(shù)? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2012-03-01 15:59 |只看該作者 |倒序瀏覽
本帖最后由 ljpdxj 于 2012-03-01 16:02 編輯



使用該函數(shù),為何它不能正確識別選項少了參數(shù)

比如
./Test --module --compress-method

其中--module是一定需要參數(shù)的

這里故意不給--module指定參數(shù),為何它會把--compress-method認為是它的參數(shù)。。。。
而不是返回程式想要的冒號:    ? (optstring第一個字符指定為了冒號)

感謝感謝。。。。。。。。!

man 3 getopt_long:

RETURN VALUE
       If  an option was successfully found, then getopt() returns the option character.  If all command-line options have been parsed, then getopt() returns -1.  If getopt() encounters an option character that was
       not in optstring, then ’?’ is returned. If getopt() encounters an option with a missing argument, then the return value depends on the first character in optstring: if it is ’:’, then ’:’ is returned;  oth-
       erwise ’?’ is returned.

       getopt_long()  and  getopt_long_only()  also return the option character when a short option is recognized.  For a long option, they return val if flag is NULL, and 0 otherwise.  Error and -1 returns are the
       same as for getopt(), plus ’?’ for an ambiguous match or an extraneous parameter.

論壇徽章:
0
2 [報告]
發(fā)表于 2012-03-01 16:27 |只看該作者
gcc -o -g /Test.c
居然生成了-g可執(zhí)行文件...

應(yīng)該算正常的行為,謝謝~
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP