I'm programming in C at a Linux environment, and I'd like my program to recognize options like '-' or '--' for execution. I wonder how do programmers typically implement this?
In my case, I made the main
function receive argc
, argv
arguments. Is that correct?
// headers
int main(int argc, char* argv[])
{
// my codes
}
and I'd like my program to recognize options like '-' or '--' for execution. I wonder how do programmers typically implement this?
Programmers have two ways:
getopt
(more listed here)