strncpy

Copy a string.

char * strncpy (char * dest, char * source, size_t max);

Required Header
<string.h>

Return Value

The destination string is returned.

Parameters

dest

  A string buffer

source

  A string

max

  The maximum number of characters to copy

Remarks

The strncpy function copies at most max characters from source to dest and returns the address of dest. There must be enough space in the dest buffer to prevent unexpected results. A null-terminator is not copied when the max character limit has been reached.

String

See Also    memcpy, strcat, strcmp, strcpy