Name

wcsncoll - wide-character string comparison using collating information

Library

libc.lib

Synopsis

  #include <wchar.h>
  int wcsncoll (const wchar_t *s1, const wchar_t *s2, int n);

Return values

The wcsncoll function returns an integer greater than, equal to, or less than 0, if s1 is greater than, equal to, or less than s2.

No return value is reserved to indicate errors; callers should set errno to 0 before calling wcsncoll. If it is non-zero upon return from wcsncoll, an error has occurred.


Detailed description

The wcsncoll function compares the first n chars from the two null-terminated strings s1 and s2 according to the current locale collation order. In the "C" locale, wcsncoll is equivalent to wcscmp.

Examples

#include <wchar.h>
/* Illustrates how to use wcsncoll API */
int example_wcsncoll (void)
{  
        /* compares the two strings */
  if( wcsncoll(L"abcdef",L"abcdeg",7) != L’f’-L’g’)  
   return -1;
 return 0;
}

         


Errors

The wcsncoll function will fail if:
[EILSEQ]
  An invalid wide character code was specified.
[ENOMEM]
  Cannot allocate enough memory for temporary buffers.

Limitations

The current implementation of wcsncoll is not affected by the LC_CTYPE category of the current locale. It is equivalent to wcscoll in this implementation.

See also

setlocale, strcoll, wcscoll, wcsncmp, wcsxfrm

Bugs

The current implementation of wcsncoll only works in single-byte LC_CTYPE locales, and falls back to using wcscoll in locales with extended character sets.

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top