strcmpi: does not return right result


It seems that I am not able to use strcmpi function properly.

1
2
3
4
5
  		bool res = strcmpi(FilterType, "TwoD");
		std::cout<< "response is " << res << "\n";

		bool res2 = (FilterType == "TwoD");
		std::cout<< "response2 is " << res2 << "\n";


I would expect the value of "res" and "res2" to be identical. But, this is not the case.
1
2
3
response is 0
response2 is 1


Some help would be appreciated.
strcmpi (and all strcmp family) returns 0 when strings are equal.
@MiiNiPaa, thanks. I was expecting it to return 1; hence, I was confused.
it does a bit more than that,

<0 for strings alphabetically less than
>0 for strings alphabetically greater than
==0 for matching strings.
> I would expect the value of "res" and "res2" to be identical
strcmp compares content
== compares memory address

They are quite different things.
Topic archived. No new replies allowed.