xref: /original-bsd/lib/libc/string/strncpy.3 (revision 84bbc80e)
Copyright (c) 1990 The Regents of the University of California.
All rights reserved.

This code is derived from software contributed to Berkeley by
Chris Torek.

%sccs.include.redist.man%

@(#)strncpy.3 5.1 (Berkeley) 05/15/90

STRNCPY 3 ""
C 4
NAME
strncpy - copy strings of limited length
SYNOPSIS
#include <string.h>

char *
strncpy(char *dst, const char *src, size_t len);
DESCRIPTION
Strncpy writes exactly len characters into dst by copying string src to dst , appending '\e0' characters if src is less than len characters long, and not terminating dst if src is more than len characters long. Strncpy returns dst .
EXAMPLES
The following sets ``chararray'' to ``abc\e0\e0\e0'': (void)strncpy(chararray, "abc", 6).

The following sets ``chararray'' to ``abcdef'':

(void)strncpy(chararray, "abcdefgh", 6);

SEE ALSO
bcopy(3), memccpy(3), memcpy(3), memmove(3), strcpy(3)
STANDARDS
Strncpy conforms to ANSI X3.159-1989 (``ANSI C'').