int lstrcmp(lpszString1, lpszString2) | |||||
LPCTSTR lpszString1; | /* address of first string | */ | |||
LPCTSTR lpszString2; | /* address of second string | */ |
The lstrcmp function compares two character strings. The comparison is case sensitive.
lpszString1
Points to the first null-terminated string to be compared.
lpszString2
Points to the second null-terminated string to be compared.
The return value is negative if the string specified in lpszString1 is less than the string specified in lpszString2, is positive if lpszString1 is greater than lpszString2, and is zero if the two strings are equal.
The lstrcmp function compares two strings by checking the first characters against each other, the second characters against each other, and so on until it finds an inequality or reaches the ends of the strings. The function returns the difference of the values of the first unequal characters it encounters. For example, lstrcmp determines that “abcz” is greater than “abcdefg” and returns the difference of “z” and “d”.
The language driver for the language selected by the user determines which string is greater (or whether the strings are the same). If no language driver is selected, Windows uses an internal function. With the Windows United States language functions, uppercase characters have lower values than lowercase characters.
With a double-byte character set (DBCS) version of Windows, this function can compare two DBCS strings.
lstrcmpi