Hi, I in desperate need of help. I have most of my functions in a program working, but in order to call them I need to use the command line arguments
In order to access a particular function like the create mode the user woul input
dataprog C filename.dat
so I try inputting argv[1] in the switch, but everything I try doesn't work
here is the code for main
int main(int argc, char *argv[])
{
if(argc !=3)
{
printf("Usage: dataprog <Mode C A or Q> <filename>\n");
exit(1);
}
switch (argv[1]) {
case 'A' : append_mode(char argv[]);
break;
case 'C' : create_mode(char argv[]);
break;
case 'Q' : query_mode(char argv[]);
break;
default: printf("Illegal code, enter (C)reate, (A)ppend or (Q)uery.\n");
}
return 0;
}
Your help would be very much appreciated