Using getopt()
| Hi, I'm new here so I'm not sure if my question is in the correct category. I'm having problems with getopt(). Here's what I'm doing. I'm calling getopt() from C. I'm invoking my C program like this: myprog -a -b -c And in C: while ((c = getopt (argc, argv, "a:b:c")) != -1) { ... } The idea is to have arguments for all the options. What happens though is that if I leave off the argument for option -a getopt thinks -b is the argument for option -a and getopt doesn't return an error. Is this how getopt should work? I thought getopt would recognise that -b is an option. Thanks in advance for any help. |
No comments:
Post a Comment