I'm building a command line interface for a program and the program doesn't seem to be reading the functions inside the "else if" statements. The program compiles and everything but nothing happens when I type the arguments into the command line. I think there might be something wrong with my argc and argv code but I'm not sure. Any help would be much appreciated. Thanks guys!
Code:
int main(int argc, char *argv[])
{
FILE *ISP_file;
FILE *SP_file;
//FILE *TempFile;
int i = 0;
for(i = 0;i < argc; i++)
{
if(0 == stricmp("Interrogator", argv[i]))
{
InterrogatorProtocol1553Flag = TRUE;
}
else if(0 == stricmp("MLV_PLV_179", argv[i]))
{
Interrogator_OFP_Select = INT_OFP_DMV_179;
DirectFlashProgFlag = FALSE;
//ISP_file = fopen(FopISP_DataFile, "rb");
SP_file = fopen(FopSP_DataFile, "rb");
//TempFile = fopen(TempFilePath, "wb");
Execute1553();
}
else if(0 == stricmp("MLV_PLV_183", argv[i]))
{
Interrogator_OFP_Select = INT_OFP_DMV_183;
DirectFlashProgFlag = FALSE;
//ISP_file = fopen(FopISP_DataFile, "rb");
SP_file = fopen(FopSP_DataFile, "rb");
//TempFile = fopen(TempFilePath, "wb");
Execute1553();
}
else if(0 == stricmp("DirectFlash", argv[i]))
{
Interrogator_OFP_Select = INT_OFP_DMV_179;
DirectFlashProgFlag = TRUE;
ISP_file = fopen(FopISP_DataFile, "rb");
SP_file = fopen(FopSP_DataFile, "rb");
//TempFile = fopen(TempFilePath, "wb");
Execute1553();
}
else if(0 == stricmp("SRecord", argv[i]))
{
Interrogator_OFP_Select = INT_OFP_DMV_183;
DirectFlashProgFlag = TRUE;
ISP_file = fopen(FopISP_DataFile, "rb");
SP_file = fopen(FopSP_DataFile, "rb");
//TempFile = fopen(TempFilePath, "wb");
Execute1553();
}
else
{
fprintf(stderr, "Unknown parameter: %s", argv[i]);
}
}