safec
3.2
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_str_lib.h"
Functions | |
EXPORT errno_t | strncpy_s (char *restrict dest, rsize_t dmax, const char *restrict src, rsize_t slen) |
The strncpy_s function copies not more than slen successive characters (characters that follow a null character are not copied) from the array pointed to by src to the array pointed to by dest. More... | |
EXPORT errno_t strncpy_s | ( | char *restrict | dest, |
rsize_t | dmax, | ||
const char *restrict | src, | ||
rsize_t | slen | ||
) |
The strncpy_s function copies not more than slen successive characters (characters that follow a null character are not copied) from the array pointed to by src to the array pointed to by dest.
If no null character was copied from src, then dest[n] is set to a null character.
All elements following the terminating null character (if any) written by strncpy_s in the array of dmax characters pointed to by dest take unspeciļ¬ed values when strncpy_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with NULL bytes.
[out] | dest | pointer to string that will be replaced by src. |
[in] | dmax | restricted maximum length of dest |
[in] | src | pointer to the string that will be copied to dest |
[in] | slen | the maximum number of characters to copy from src |
EOK | successful operation, the characters in src were copied to dest and the result is null terminated. |
ESNULLP | when dest/src is NULL pointer |
ESZEROL | when dmax = 0. Before C11 also with slen = 0 |
ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
ESOVRLP | when strings overlap |
ESNOSPC | when dest < src |