Search code examples
ccommand-line-argumentsgetoptgetopt-long

Command-line options in C


I would like to create a C program that accepts an argument of the form

-aK

where K is some integer from 0-9.

How would I parse/specify this option?


Solution

  • You might want to check out getopt and/or getopt_long.