lstrcmp

 

Description

The lstrcmp (alias strcmp) function compares two character strings. The comparison is case sensitive.

Syntax

int lstrcmp( LPCSTR lpString1, LPCSTR lpString2 )

Parameters

lpString1
[input] Pointer to the first null-terminated string to be compared.
lpString2
[input] Pointer to the second null-terminated string to be compared.

Return

If the string pointed to by lpString1 is less than the string pointed to by lpString2, the return value is negative.

If the string pointed to by lpString1 is greater than the string pointed to by lpString2, the return value is positive.

If the strings are equal, the return value is zero.

Examples

EX1

void lstrcmp_ex1()
{
    string    str1 = "Hello World!";
    int     cmp = lstrcmp(str1, "HELLO WORLD!");    // cmp equals -1.
    out_int("cmp = ", cmp);
}

Remark

See Also

strcmp

header to Include

origin.h

Reference