Thread: Command line argc and argv problems.

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    9

    Command line argc and argv problems.

    I am trying to make a program run from the Windows command line and it doesn't seem to be reading the function inside the parameters. What I basically want to happen is the user will type the information into the command line like "Program name Parameter name AppFile path BootFile Path" then the program will take the file paths you manually typed in and run them throught the Execute 1553 function which is defined elsewhere in the program. Please look at my code and see if you can help me figure out what's wrong. Thanks guys!

    Code:
    int main(int argc, char *argv[])
    {
        FILE   *ISP_file;
        FILE   *SP_file;
         
        int i = 1;
     
        for(i = 1; i < argc; i++)
      
       {
            if(!strcmp("Interrogator", argv[i])) 
            {
                printf ("Parameter %d read - Interrogator", i);
                InterrogatorProtocol1553Flag = TRUE;
            }
           else if(!strcmp("SRecord", argv[i])) 
            {
                Interrogator_OFP_Select = INT_OFP_DMV_183;
                DirectFlashProgFlag = TRUE;
                if(Execute1553(ISP_file, SP_file) != 0)    
                printf("Calculation failed\n"); 
            }
      
            else
            {
                fprintf(stderr, "Unknown parameter: %s", argv[i]);
            }
        }

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    Why did you open a new topic, you already have one open for this problem?

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Command line argc and argv help.
    By jwernig in forum C Programming
    Replies: 12
    Last Post: 07-16-2013, 06:52 AM
  2. Still more problems with argv and argc
    By MikeyIckey in forum C Programming
    Replies: 16
    Last Post: 02-23-2009, 08:40 PM
  3. command line arguments using argc and argv.
    By Cudarich in forum C Programming
    Replies: 2
    Last Post: 12-05-2004, 07:32 AM
  4. argv and argc command line params
    By iain in forum C Programming
    Replies: 4
    Last Post: 10-09-2002, 04:15 PM
  5. command line argv argc help?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 05-08-2002, 06:07 AM

Tags for this Thread