在 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章