Feeds:
Posts
Comments

Posts Tagged ‘getopt’

The main() function’s double life :::

  • int main (int argc, char *argv[]);
  • int main (int argc, char **argv);

The global variables set by getopt() include:

  1. optarg ::: A pointer to the current option argument, if there is one
  2. optind ::: An index of the next argv pointer to process when getopt() is called again
  3. optopt ::: This is the last known option

If you don’t want getopt to print error message, you can set opterr to zero

————————————————————————————————-

Read Full Post »