.\" 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) %G% .\" .TH STRNCPY 3 "" .UC 4 .SH NAME strncpy \- copy strings of limited length .SH SYNOPSIS .nf .ft B #include char * strncpy(char *dst, const char *src, size_t len); .ft R .fi .SH DESCRIPTION .B Strncpy writes exactly .I len characters into .I dst by copying string .I src to .IR dst , appending '\e0' characters if .I src is less than .I len characters long, and .I not terminating .I dst if .I src is more than .I len characters long. .B Strncpy returns .IR dst . .SH EXAMPLES The following sets ``chararray'' to ``abc\e0\e0\e0'': .sp .ti +0.5i (void)strncpy(chararray, "abc", 6). .PP The following sets ``chararray'' to ``abcdef'': .sp .RS (void)strncpy(chararray, "abcdefgh", 6); .RE .SH SEE ALSO bcopy(3), memccpy(3), memcpy(3), memmove(3), strcpy(3) .SH STANDARDS .B Strncpy conforms to ANSI X3.159-1989 (``ANSI C'').