Hi, I am trying to get this program to take some command line arguements like -l for logging. The problem is my program does not seem to think argv[4] == "-l". Here is my arg check:
and here is my input:Code:/*Check args*/ if(argc < 4 || argc == 5 || argc > 6 || (argc == 6 && argv[4] != "-l")){ cerr << "Incorrect set of parameters(" << argc <<") Usage: sqltest new_file.txt [-load|old_file.txt] database.db [-l log.txt]\n"; exit(1); }
I removed this from my if statement:Code:sqltest NEW.txt -load new.db -l logfile.txt
and it worked so I am pretty sure I am missing something about comparing command line args to const char*. The same thing is happening when I check argv[2] for "-load" as well.Code:(argc == 6 && argv[4] != "-l")
thanks