Search code examples
c++stringstrcmp

compare char* with string macro


I have the following code:

#define INPUT_FILE "-i"

int main(int argc, char* argv[]) {
     ....
}

is there any way in C++ to compare between strings in argv[] and INPUT_FILE? I tried

strcmp(argv[1],INPUT_FILE)

It compiles but return false each time.

Thanks !


Solution

  • strcmp returns 0 if there is a match.