1STRNCMP(3P) POSIX Programmer's Manual STRNCMP(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 strncmp - compare part of two strings
13
15 #include <string.h>
16
17 int strncmp(const char *s1, const char *s2, size_t n);
18
19
21 The strncmp() function shall compare not more than n bytes (bytes that
22 follow a null byte are not compared) from the array pointed to by s1 to
23 the array pointed to by s2.
24
25 The sign of a non-zero return value is determined by the sign of the
26 difference between the values of the first pair of bytes (both inter‐
27 preted as type unsigned char) that differ in the strings being com‐
28 pared.
29
31 Upon successful completion, strncmp() shall return an integer greater
32 than, equal to, or less than 0, if the possibly null-terminated array
33 pointed to by s1 is greater than, equal to, or less than the possibly
34 null-terminated array pointed to by s2 respectively.
35
37 No errors are defined.
38
39 The following sections are informative.
40
42 None.
43
45 None.
46
48 None.
49
51 None.
52
54 strcmp(), the Base Definitions volume of IEEE Std 1003.1-2001,
55 <string.h>
56
58 Portions of this text are reprinted and reproduced in electronic form
59 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
60 -- Portable Operating System Interface (POSIX), The Open Group Base
61 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
62 Electrical and Electronics Engineers, Inc and The Open Group. In the
63 event of any discrepancy between this version and the original IEEE and
64 The Open Group Standard, the original IEEE and The Open Group Standard
65 is the referee document. The original Standard can be obtained online
66 at http://www.opengroup.org/unix/online.html .
67
68
69
70IEEE/The Open Group 2003 STRNCMP(3P)