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