作者:
gn123 (GnCtIlike)
2015-04-12 00:56:57開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux 工作站
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
想請問為何c++ argv參數是否有什麼限制呢?
這是我餵給argv的參數:
./execute.sh -r -i _____ -o rank-list -m model
本來_____都用query_test.xml(query後面接底線)來測,都正常跑
但是測某一個擋叫做 query-test.xml(query後面接-)來測時
就跑出了以下訊息:
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase: __pos (which .......
./execute.sh: line 1: 4462 已經終止 ./test_3_xml $1 $2 $3 $4 $5 ...
然後程式就終止了@@
餵入的資料(Input):
./execute.sh -r -i query_test.xml -o rank-list -m model => 正常
./execute.sh -r -i query-test.xml -o rank-list -m model => 意外終止
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase: __pos (which .......
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
不太熟悉工作站的環境,希望高手幫忙一下,感恩
如果有違反版規在自刪
謝謝
作者:
LPH66 (-6.2598534e+18f)
2015-04-12 02:39:00是說, 不知道你為什麼要多一層 shell script, 不過要傳所有參數進去用 "$@" 應該會好一點, 也不用費力寫一堆 $1$2$3"$@" 的引號要加, 否則有些參數會傳錯