Questions regarding char *argv[ ]...
I'm working on a program that accepts command line arguments and I was wondering if it would be OK to hard code the search pattern for argv[ ] because you already know what it's going to be looking for.
ex:
Code:
int main (int argc, char *argv[ ])
{
int i;
for(i = 0; *argv[1][i] != " "; i++)
{
if(*argv[1][i] == "-")
i++;
if(*argv[1][i] == "r")
//more statements here etc etc
}
}
Is that an acceptable way to search for command line options?
Is there a better way that anyone has found?
Thanks for any advise.