comparison failure with string with special characters

I have used char *var = ".x_t"; int iIsValid = _stricmp(var, ".x_t");

Here I am expecting comparison result to be 0,but for var with value ".x_t" returns 32. NOTE: value of var varies but for example purpose I have hardcoded it.

One doubt I have here is string to be compared contains "_" ,is this really causing comparison failure?
why aren't you using strcmp ?
_stricmp obviously compares the lower-case versions, which might not lead to the intended result...
stricmp throws warning as -warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. I am using VS 2008
closed account (zb0S216C)
MSDN have an entire page dedicated to _stricmp( )[1].


Last edited on
Topic archived. No new replies allowed.