Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (s) strncpy(3)
NAME
strncpy - Copies a string
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>
char *strncpy(
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 Specifies the number of bytes to copy.
DESCRIPTION
The strncpy() function copies no more than the number of bytes specified by the n parameter
from the location pointed to by the s2 parameter to the location pointed to by the s1 parameter.
Bytes following a null character are not copied.
When the location pointed to by the s2 parameter is a string whose byte length is less than the
value specified by the n parameter, null characters are appended to the s1 string until n bytes are
contained in the string.
NOTES
When operating on overlapping strings, the behavior of this function is unreliable.
RETURN VALUES
Upon successful completion, the strncpy( ) function returns a pointer to the resulting string. Oth-
erwise, this function returns a null pointer.
RELATED INFORMATION
Functions: strcat(3), strcmp(3), strcpy(3), strncat(3), strncmp(3).
527187-017 Hewlett-Packard Company 6161