title: getopt() in ANSI C
body: <p>I am working on <code>OPNET</code> and for that, I need the windows equivalent <code>getopt()</code> function in ANSI C language. </p>
  
  <p>I need to call <code>getopt()</code> similar like :</p>
  
  <pre><code>while ((opt = getopt(argc, argv, "hadp:s")) != -1) {
      switch (opt) {
          case 'a':
              break;
          case 'd':
              dummy = 1;
              break;
          case 'p':
              res = atoi(optarg);
              if (1 &lt;= res )
                  break;
              else
                  usage(argv[0]);
                  break;
          case 's':
              use_decimal = 0;
              break;
          case 'h':
          default:
              usage(argv[0]);
      }
  }
  </code></pre>
  
  <p>Now, when I compile, I am getting error that <code>getopt()</code> is undefined. I defined its header file but it can not be included in OPNET. So, I wanted to ask that how should I overcome this problem.</p>