title: c++ getopt() parameter identification
body: <p>Hi i'm testing out the default <code>getopt()</code> program that can be found <a href="https://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html#Example-of-Getopt" rel="nofollow noreferrer">here</a>.</p>
  
  <p>When I run this code and I type for example <code>myProgram -c -b. -c</code> it takes <code>-b</code> as an parameter. As I understood it when reading about <code>getopt()</code>, characters that begin with <code>-</code> are treated as a special case. Can I get <code>getopt()</code> to instead of taking <code>-b</code> as an parameter to <code>-c</code> run <code>-c</code> without arg and then <code>-b</code> instead?</p>
  
  <pre><code>while ((c = getopt(argc, argv, "abc:")) != -1) 
      {
      char test = 111;
      std::cout &lt;&lt; test &lt;&lt; std::endl;
      switch (c) {
      case 'a':
          aflag = 1; break;
      case 'b':
          bflag = 1; break;
      case 'c':
      {
          cvalue = optarg;
          break;
      }
      case '?':
          if (isprint(optopt))
          {
              fprintf(stderr, "Unknown option `-%c'.\n", optopt);
          }
          else
              fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
          return 1;
      default:
          abort();
      }
  </code></pre>