I am trying to compare the parameter of command with argv[] but it\'s not working. Here is my code.
./a.out -d 1
In main function
In C++ let std::string do the work for you:
#include int main (int argc, char * const argv[]) { if (argv[1] == std::string("-d")) // call some function here }
In C you'll have to use strcmp:
if (strcmp(argv[1], "-d") == 0) // call some function here }