Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strncat(3) [osf1 man page]

strncat(3)						     Library Functions Manual							strncat(3)

NAME
strncat, strncmp, strncpy - Perform operations on string LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> char *strncat( char *s1, const char *s2, size_t n); int strncmp( const char *s1, const char *s2, size_t n); char *strncpy( char *s1, const char *s2, size_t n); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strncat(), strncmp(), strncpy(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a location containing the first string or array. Points to a location containing the second array. Specifies the number of bytes. In strncat(), n specifies the maximum number of bytes to append; in strncmp(), n specifies the maximum number of bytes to compare; and in strncpy(), n specifies the number of bytes to copy. DESCRIPTION
The strncat() function appends no more than n bytes from the array pointed to by the s2 parameter to the end of the array pointed to by the s1 parameter. The initial byte of the array pointed to by s2 overwrites the null byte at the end of a string pointed to by s1. It then appends a null byte to the result, and returns s1. When operating on overlapping objects, the behavior of this function is unreliable. The strncmp() function compares the string or array pointed to by the s1 parameter to the array 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 strncmp() functions compares bytes until it has compared n bytes or until it reaches a terminating null byte. The strncmp() function compares objects based on the machine collating order. It does not use the locale-dependent sorting order. Use the strcoll() or wcscoll() functions for locale-dependent sorting. The strncpy() function copies no more than n bytes from the array pointed to by the s2 parameter to the array pointed to by the s1 parame- ter. Bytes following a null byte are not copied. When operating on overlapping locations, the behavior of this function is unreliable. When the location pointed to by the s2 parameter is an array that is shorter than n bytes, null bytes are appended to the s1 value until n bytes in all are written. RETURN VALUES
Upon successful completion, the strncat() and strncpy() functions return a pointer to the resulting string or array. [Tru64 UNIX] Other- wise, these functions return a null pointer. Upon successful completion, the strncmp() function returns an integer whose value is greater than, equal to, or less than 0 (zero), accord- ing to whether the value of the s1 object is greater than, equal to, or less than the value of the s2 object. [Tru64 UNIX] When a success- ful comparison cannot be made, strncmp() returns a value of 0 (zero). RELATED INFORMATION
Functions: string(3), strcasecmp(3), strcat(3), strcmp(3), strcoll(3), strcpy(3), wcscoll(3), wcsncat(3), wcsncmp(3), wcsncpy(3) Standards: standards(5) delim off strncat(3)

Check Out this Related Man Page

wcsncat(3)						     Library Functions Manual							wcsncat(3)

NAME
wcsncat, wcsncmp, wcsncpy - Perform operations on wide-character strings with a character count LIBRARY
Standard C Library (libc) SYNOPSIS
#include <wchar.h> wchar_t *wcsncat( wchar_t *wcstring1, const wchar_t *wcstring2, size_t number); int wcsncmp( const wchar_t *wcstring1, const wchar_t *wcstring2, size_t number); wchar_t *wcsncpy( wchar_t *wcstring1, const wchar_t *wcstring2, size_t number); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: wcsncat(), wcsncmp(), wcsncpy(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a location containing the first wide-character string. Points to a location containing the second wide-character string. Speci- fies the number of wide characters in the string operation. In wcsncat(), specifies the maximum number of wide characters to append; in wcsncmp(), specifies the maximum number of wide characters to compare; and, in wcsncpy, specifies the number of wide characters to copy. DESCRIPTION
The wcsncat(), wcsncmp(), and wcsncpy() functions operate on null-terminated, wide-character strings. The wcsncat() function appends wide characters from the wcstring2 parameter to the end of the wcstring1 parameter. The initial character of the wcstring2 parameter overwrites the terminating null wide character of the wcstring1 parameter. The wcsncat() function appends char- acters until it encounters a null wide character in wcstring2 or appends, at most, the number of characters specified by the value of the number parameter. The function then appends a null wide character to the result and returns wcstring1. When operating on strings stored in fields that overlap, the behavior of this function is unreliable. The wcsncmp() function compares the wide characters in the wcstring1 parameter to the wcstring2 parameter. The wcsncmp() function compares wide characters until it has compared number wide characters or until it has reached a terminating null wide character. The function com- pares, at most, the number of wide characters specified by the value of the number parameter. When operating on strings stored in fields that overlap, the behavior of this function is unreliable. The wcsncmp() function compares strings based on the machine collating order. It does not use the locale-dependent sorting order. Use the wcscoll() function for locale-dependent sorting. The wcsncpy() function copies wide characters from the wcstring2 parameter to the wcstring1 parameter and returns wcstring1. The function copies the number of wide characters specified by the value of the number parameter. If wcstring2 is shorter than number characters, wcstring1 is padded out to number characters with null wide characters. However, if there is no null wide character in the first number characters of the wcstring2 array, the result in the wcstring1 array is not null terminated. RETURN VALUES
On successful completion, the wcsncat() and wcsncpy() functions return a pointer to the resulting string, wcstring1. On successful completion, the wcsncmp() function returns an integer whose value is greater than 0 (zero) if wcstring1 is greater than wcstring2, returns 0 (zero) if the strings are equivalent, and returns an integer whose value is less than 0 (zero) if wcstring1 is less than wcstring2. No return value is reserved to indicate an error condition for any of these functions. RELATED INFORMATION
Functions: strncat(3), wcscat(3), wcschr(3), wcscoll(3), wcslen(3), wcsspn(3) Standards: standards(5) delim off wcsncat(3)
Man Page