strlcpy

March 26, 2020 Contributors

Name

strlcpy — Size-bounded C string copying function

Synopsis

#include "util.h"

| size_t **strlcpy** ( | dst, |   |
|   | src, |   |
|   | size); |   |

char * <var class="pdparam">dst</var>;
const char * <var class="pdparam">src</var>;
size_t <var class="pdparam">size</var>;

Description

Note

This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

Size-bounded C string copying function.

Copies as many characters from src as will fit in dst, given that dst has at least size bytes of storage space available. Guarantees to NUL-terminate dst if size > 0.

Parameters

src

the string to copy from

dst

the string to copy to

size

the size of dst (including the terminating NUL)

Return Values

Returns the length of src. If the return value >= size, there was insufficient space in dst and truncation took place.