Comparing an argv element to a string?

I'm having problem with comparing the two in an if statement. I am doing this:

if(argv[1]=="-e"){cerr << 'E';}

but the program skips over it as if argv[1] does not equal to "-e". But, I had the program print what argv[1] is earlier in the code, and it is "-e". What's the problem?
both argv[1] and "-e" are char* (pointer to character). Pointers are basically numbers and when you compare pointers, you just compare those numbers. So argv[1] will be == "-e" when they both point to the same pice of memory. To compare two strings, either use strcmp or convert them from char* to std::string and use usual operators for comparison.
Topic archived. No new replies allowed.