Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

strncmp(3) Guardian Native C Library Calls Reference Manual
NAME
strncmp - Compares two strings
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
SYNOPSIS
#include <string.h>
int strncmp(
const char *s1,
const char *s2,
size_t n);
PARAMETERS
s1 Points to a location containing first string.
s2 Points to a location containing the second of two strings referenced.
n Species the maximum number of bytes to compare.
DESCRIPTION
The strncmp() function compares the string pointed to by the s1 parameter to the string pointed
to by the s2 parameter. The sign of a nonzero value returned by strncmp() is determined by the
sign of the difference between the values of the first pair of bytes (both interpreted as unsigned
char) that differ in the two compared objects. The strncmp() function compares bytes until it
has compared n bytes or until it reaches a terminating null byte.
The strncmp() function compares strings based on the machine collating order. It does not use
the locale-dependent sorting order. Use the strcol() or wcscol() functions for locale-dependent
sorting.
RETURN VALUES
Upon successful completion, the strncmp() function returns an integer whose value is greater
than, equal to, or less than 0 (zero), according to whether the s1 string is greater than, equal to, or
less than the s2 string. When a successful comparison cannot be made, this function returns a
value of 0 (zero).
RELATED INFORMATION
Functions: strcat(3), strcmp(3), strcpy(3), strncat(3), strncpy(3).
6108 Hewlett-Packard Company 527192-018