If I wanted to validate if the user has entered a specific parameter to the program how would I do it? This is my current code:
#include <iostream>
#include <cstdlib>
int main (int argc, char* argv[]) {
if (argv[1] == "--para") {
std::cout << "Some text here..." << std::endl;
}
}
The code above will not work because I need some way to convert the parameter to a string so I can validate it in my if statement.
What I do not know is how to check if the --para exists at all when using multiple parameters into the program.
Example:
./main parameter1 parameter2 --para