1wcsncmp(3) Library Functions Manual wcsncmp(3)
2
3
4
6 wcsncmp - compare two fixed-size wide-character strings
7
9 Standard C library (libc, -lc)
10
12 #include <wchar.h>
13
14 int wcsncmp(const wchar_t s1[.n], const wchar_t s2[.n], size_t n);
15
17 The wcsncmp() function is the wide-character equivalent of the
18 strncmp(3) function. It compares the wide-character string pointed to
19 by s1 and the wide-character string pointed to by s2, but at most n
20 wide characters from each string. In each string, the comparison ex‐
21 tends only up to the first occurrence of a null wide character (L'\0'),
22 if any.
23
25 The wcsncmp() function returns zero if the wide-character strings at s1
26 and s2, truncated to at most length n, are equal. It returns an inte‐
27 ger greater than zero if at the first differing position i (i < n), the
28 corresponding wide-character s1[i] is greater than s2[i]. It returns
29 an integer less than zero if at the first differing position i (i < n),
30 the corresponding wide-character s1[i] is less than s2[i].
31
33 For an explanation of the terms used in this section, see at‐
34 tributes(7).
35
36 ┌────────────────────────────────────────────┬───────────────┬─────────┐
37 │Interface │ Attribute │ Value │
38 ├────────────────────────────────────────────┼───────────────┼─────────┤
39 │wcsncmp() │ Thread safety │ MT-Safe │
40 └────────────────────────────────────────────┴───────────────┴─────────┘
41
43 C11, POSIX.1-2008.
44
46 POSIX.1-2001, C99.
47
49 strncmp(3), wcsncasecmp(3)
50
51
52
53Linux man-pages 6.04 2023-03-30 wcsncmp(3)