VMS Help  —  CRTL  wcsncmp
    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);

1  –  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).

2  –  Description

    The strings are compared until a null character is encountered,
    the strings differ, or maxchar is reached. If characters differ,
    wcsncmp returns:

    o  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

    o  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 0.

    See also wcscmp.

3  –  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.
Close Help