Copies not more than maxchar characters from str_2
into str_1.
Format
#include <string.h>
char *strncpy (char *str_1, const char *str_2,
size_t maxchar);
Function Variants
This function also has variants named _strncpy32 and _strncpy64
for use with 32-bit and 64-bit pointer sizes, respectively. See
Section 1.8 for more information on using
pointer-size-specific functions.
Arguments
- str_1, str_2
- Pointers to character strings.
- maxchar
- The maximum number of characters to copy from str_2
to str_1 up to but not including the null terminator of
str_2.
Description
This function copies no more than maxchar characters
from str_2 to str_1, up to but not including the
null terminator of str_2. If str_2 contains less
than maxchar characters, str_1 is padded with
null characters. If str_2 contains greater than or equal
to maxchar characters, as many characters as possible are
copied to str_1. Be aware that the str_1 argument
might not be terminated by a null character after a call to strncpy.
Return Value
Previous Page | Next Page | Table of Contents | Index