StrCmpNA function (shlwapi.h)

Compares a specified number of characters from the beginning of two strings to determine if they are the same. The comparison is case-sensitive. The StrNCmp macro differs from this function in name only.

Syntax

int StrCmpNA(
  [in] PCSTR psz1,
  [in] PCSTR psz2,
  [in] int   nChar
);

Parameters

[in] psz1

Type: PCTSTR

A pointer to the first null-terminated string to be compared.

[in] psz2

Type: PCTSTR

A pointer to the second null-terminated string to be compared.

[in] nChar

Type: int

The number of characters from the beginning of each string to be compared.

Return value

Type: int

Returns zero if the strings are identical. Returns a positive value if the first nChar characters of the string pointed to by psz1 are greater than those from the string pointed to by psz2. It returns a negative value if the first nChar characters of the string pointed to by psz1 are less than those from the string pointed to by psz2.

Remarks

Note

The shlwapi.h header defines StrCmpN as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)