Compares not more than maxchar characters of two wide-
character strings. It returns an integer that indicates if the
strings are different, and how they differ.
Format
#include <wchar.h>
int wcsncmp (const wchar_t *wstr_1, const wchar_t
*wstr_2, size_t maxchar);
Arguments
- wstr_1, wstr_2
- Pointers to null-terminated wide-character strings.
- maxchar
- The maximum number of characters to search in both wstr_
1 and wstr_2. If maxchar is 0, no comparison
is performed and 0 is returned (the strings are considered equal).
Description
The strings are compared until a null character is
encountered, the strings differ, or maxchar is reached.
If characters differ, the function returns:
- An integer less than 0 if the codepoint of the first
differing character in wstr_1 is less than the codepoint
of the corresponding character in wstr_2
- An integer greater than 0 if the codepoint of the first
differing character in wstr_1 is greater than the
codepoint of the corresponding character in wstr_2
If no differences are found after comparing maxchar
characters, the function returns zero.
See also wcscmp in this section.
Return Values
< 0 | Indicates that wstr_
1 is less than wstr_2. |
0 | Indicates that wstr_1 equals wstr_
2. |
> 0 | Indicates that
wstr_1 is greater than wstr_2. |
Previous Page | Next Page | Table of Contents | Index