在 C++ 中解析命令行参数? [关闭] - Parsing Command Line Arguments in C++? [closed]

问题:

Closed . 关闭 This question needs to be more focused . 这个问题需要更加集中 It is not currently accepting answers. 它目前不接受答案。
Closed 7 months ago . 7 个月前关闭。
Locked . 锁定 This question and its answers are locked because the question is off-topic but has historical significance. 此问题及其答案已锁定,因为该问题偏离主题但具有历史意义。 It is not currently accepting new answers or interactions. 它目前不接受新的答案或互动。

What is the best way of parsing command-line arguments in C++ if the program is specified to be run like this:如果程序被指定为这样运行,那么在 C++ 中解析命令行参数的最佳方法是什么:

prog [-abc] [input [output]]

Is there some way of doing this built into the standard library, or do I need to write my own code?标准库中是否有某种方法可以做到这一点,还是我需要编写自己的代码?


Related:有关的:


解决方案:

参考一: https://en.stackoom.com/question/3dCO
参考二: https://stackoom.com/question/3dCO
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章