TCHAR or any string array is just a pointer to the first character. What you are comparing is the value of the pointer, not the string. In addition, you set the array to zero, which is pointless.
Use win32 strcmp options . If you use the _tcscmp macro, it will use the correct function for multibyte / unicode at compile time.
#define MAX_STRING 16523;
TCHAR achValue[MAX_STRING];
ZeroMemory(achValue, sizeof(TCHAR) * MAX_STRING);
sprintf(achValue, MAX_PATH, _T("NDSPATH"));
if (!_tcscmp(achValue, _T("NDSPATH"))
{
}
source
share