| 1 |
'\" t |
| 2 |
.\" Copyright, Bruno Haible <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH wcsncmp 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
wcsncmp \- compare two fixed-size wide-character strings |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <wchar.h> |
| 16 |
.P |
| 17 |
.BR "int wcsncmp(const wchar_t " s1 "[], const wchar_t " s2 "[], size_t " n ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR wcsncmp () |
| 22 |
function is the wide-character equivalent of the |
| 23 |
.BR strncmp (3) |
| 24 |
function. |
| 25 |
It compares the wide-character string pointed to by |
| 26 |
.I s1 |
| 27 |
and the |
| 28 |
wide-character string pointed to by |
| 29 |
.IR s2 , |
| 30 |
but at most |
| 31 |
.I n |
| 32 |
wide |
| 33 |
characters from each string. |
| 34 |
In each string, the comparison extends only up |
| 35 |
to the first occurrence of a null wide character (L\[aq]\[rs]0\[aq]), if any. |
| 36 |
.SH RETURN VALUE |
| 37 |
The |
| 38 |
.BR wcsncmp () |
| 39 |
function returns zero if the wide-character strings at |
| 40 |
.I s1 |
| 41 |
and |
| 42 |
.IR s2 , |
| 43 |
truncated to at most length |
| 44 |
.IR n , |
| 45 |
are equal. |
| 46 |
It returns an integer greater than zero if at the first differing position |
| 47 |
.I i |
| 48 |
.RI ( i |
| 49 |
< |
| 50 |
.IR n ), |
| 51 |
the corresponding wide-character |
| 52 |
.I s1[i] |
| 53 |
is |
| 54 |
greater than |
| 55 |
.IR s2[i] . |
| 56 |
It returns an integer less than zero if at the first |
| 57 |
differing position |
| 58 |
.I i |
| 59 |
.RI ( i |
| 60 |
< |
| 61 |
.IR n ), |
| 62 |
the corresponding |
| 63 |
wide-character |
| 64 |
.I s1[i] |
| 65 |
is less than |
| 66 |
.IR s2[i] . |
| 67 |
.SH ATTRIBUTES |
| 68 |
For an explanation of the terms used in this section, see |
| 69 |
.BR attributes (7). |
| 70 |
.TS |
| 71 |
allbox; |
| 72 |
lbx lb lb |
| 73 |
l l l. |
| 74 |
Interface Attribute Value |
| 75 |
T{ |
| 76 |
.na |
| 77 |
.nh |
| 78 |
.BR wcsncmp () |
| 79 |
T} Thread safety MT-Safe |
| 80 |
.TE |
| 81 |
.SH STANDARDS |
| 82 |
C11, POSIX.1-2008. |
| 83 |
.SH HISTORY |
| 84 |
POSIX.1-2001, C99. |
| 85 |
.SH SEE ALSO |
| 86 |
.BR strncmp (3), |
| 87 |
.BR wcsncasecmp (3) |