strncmp()

compare part of two strings 

Function


SYNOPSIS

#include <string.h>

int strncmp(const char *s1, const char *s2, size_t n);


DESCRIPTION

The strncmp() function makes a comparison of not more than n characters between the array pointed to by s1 and the array pointed to by s2. Characters that follow a null character are not compared.


PARAMETERS

s1 

Points to an array of characters terminated by a null character.

s2 

Points to a second array of characters terminated by a null character.

n 

Specifies the maximum number of characters to compare.


RETURN VALUES

The function strncmp() returns a positive integer if, within the first n bytes of string s1 and string s2, string s1 is lexically greater than string s2; zero if the first n bytes of the two strings are identical; and a negative integer if with the first n bytes string s1 is lexically less than string s2.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
memcmp(), strcasecmp(), strcmp(), strcoll(), strncasecmp()


PTC MKS Toolkit 10.5 Documentation Build 40.