Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
strcmp(3) Guardian Native C Library Calls Reference Manual
NAME
strcmp - Compares 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 strcmp(
const char *s1,
const char *s2);
PARAMETERS
s1 Specifies the first of two strings to compare.
s2 Specifies the second of two strings to compare.
DESCRIPTION
The strcmp() 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 strcmp() 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 strcmp() 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 sort-
ing.
RETURN VALUES
Upon successful completion, the strcmp() 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: malloc(3), memccpy(3), setlocale(3), strcat(3), strchr(3), strcoll(3), strcpy(3),
strlen(3), strncat(3), strncmp(3), strncpy(3), strpbrk(3), strspn(3), strtok(3), strstr(3),
strxfrm(3), wcscat(3).
6−84 Hewlett-Packard Company 527192-018