楼主:
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"$@" 的引号要加, 否则有些参数会传错