Dear forum

I would like to read parameters from the command line. I would like to give a parameter that controls the overall mode of the program, valid modes are “count”, “head”, “stat” and “CSV”. For user convenience I would like to allow the use of single letter short forms “c”, “h”, “s” and the lower case form “csv”.

I tried the code below, but it seems that argv[1] is not really a string, even though printf() seems to accept it as a string argument.

Can any one please tell how I get the string information in argv[1] into a string variable that will allow me to something like the code below.

I did look in the FAQ, but it only shows printf() and single char (like argv[1][1] == '-') usage.

Best Regards
Moses

Code:
   if (argv[1]=="c" || argv[1]=="count") {
      printf( " mode: count\n" );
   }
   else {
      if (argv[1]=="h" || argv[1]=="head") {
         printf(" mode: head\n");
      }
      else {
         if (argv[1]=="s" || argv[1]=="stat") {
            printf(" mode: stat\n");
         }
         else {
            if (argv[1]=="csv" || argv[1]=="CSV") {
               printf(" mode: CSV\n");
            }
            else {
               printf(" Unknown mode: %s\n",argv[1]);
            }
         }
      }
   }