我需要将负数传递给 getopt,我想知道是否有一种简单的方法可以将 getopt 使用的前缀(即在 case 语句中标记的“-”字符)更改为不同的字符,例如“--”或“+”。
我需要使用 Getopt::Long 来更改前缀吗?
最佳答案
使用--
(例如 yourcommand <actual options> -- -5
)将允许您在无法控制代码的情况下传递负参数。 man page for getopt州
The special argument "--" forces an end of option-scanning regardless of the scanning mode.
关于c++ - 将负数传递给 Getopt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33469445/