Checking argv[] against a string? (C++)

前端 未结 5 724
情歌与酒
情歌与酒 2020-12-28 15:05

So I\'m attempting to check the arguments that I\'m inputting into my program, and one of them is either the word \"yes\" or \"no\", entered without the quotes.

I\'

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-28 15:32

    You could also take a look into boost::program_options, though this seems a little off topic and overkill, but once you get used to it it's easy, convenient and safe to use. Some advantages are auto-generated --help for your program, plus things like string evaluation can be done safe using lexical_cast.

提交回复
热议问题