문제

I am in need of a way to parse multiple switches that come out as a single argument ( argv ), some of the switches in my program would be, for example:

-rRsc 

How would I implement getopt so that the user can enter multiple switches all as one argument, no spaces or dashes between switches, so no:

-r -R -s -c

Or is this not possible to be done with getopt? If it isnt, what else can I use that is part of the STL?

도움이 되었습니까?

해결책

Getopt already handles this case by default. You don't need to do anything special. (Scroll down to the end of this page to see an example.)

다른 팁

you should know -rRsc is equal to -r -R -s -c.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top