Alright, I'm trying to get arguments to work properly with a small test application. My code is below. I'm not too experienced at C++, so I'm not sure why when I launch test with -print (or --print) it automatically states "Not a valid option" and then finishes up.
#include <iostream>
int main(int argc, char* argv[])
{
int option;
option = 1;
char* argument;
argument = argv[option];
while (option < argc)
{
if (argument == "-print")
{
std::cout << "Printing Extra Text";
}
else
{
std::cout << "Not a valid option" << std::endl;
}
option++;
}
std::cout << "Printing normal text" << std::endl;
return 0;
}
Am I doing this right? Thanks in advance.