int lstrcmp(lpszString1, lpszString2) | |||||
LPCSTR lpszString1; | /* address of first string | */ | |||
LPCSTR 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 less than zero if the string specified in lpszString1 is less than the string specified in lpszString2, is greater than zero 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.
Both strings must be less than 64K in size.