1*61193Sbostic.\" Copyright (c) 1990, 1991, 1993 2*61193Sbostic.\" The Regents of the University of California. All rights reserved. 341973Sbostic.\" 441973Sbostic.\" This code is derived from software contributed to Berkeley by 550322Sbostic.\" Chris Torek and the American National Standards Committee X3, 650322Sbostic.\" on Information Processing Systems. 750322Sbostic.\" 841973Sbostic.\" %sccs.include.redist.man% 941973Sbostic.\" 10*61193Sbostic.\" @(#)strcpy.3 8.1 (Berkeley) 06/04/93 1141973Sbostic.\" 1248350Scael.Dd 1348350Scael.Dt STRCPY 3 1448350Scael.Os BSD 4 1548350Scael.Sh NAME 1648350Scael.Nm strcpy 1748350Scael.Nd copy strings 1848350Scael.Sh SYNOPSIS 1948350Scael.Fd #include <string.h> 2048350Scael.Ft char * 2148350Scael.Fn strcpy "char *dst" "const char *src" 2248350Scael.Ft char * 2348350Scael.Fn strncpy "char *dst" "const char *src" "size_t len" 2448350Scael.Sh DESCRIPTION 2548350ScaelThe 2648350Scael.Fn strcpy 2743631Sbosticand 2848350Scael.Fn strncpy 2948350Scaelfunctions 3048350Scaelcopy the string 3148350Scael.Fa src 3241973Sbosticto 3348350Scael.Fa dst 3448350Scael(including the terminating 3548350Scael.Ql \e0 3648350Scaelcharacter). 3748350Scael.Pp 3848350ScaelThe 3948350Scael.Fn strncpy 4048350Scaelcopies not more than 4148350Scael.Fa len 4243631Sbosticcharacters into 4348350Scael.Fa dst , 4448350Scaelappending 4548350Scael.Ql \e0 4648350Scaelcharacters if 4748350Scael.Fa src 4843631Sbosticis less than 4948350Scael.Fa len 5043631Sbosticcharacters long, and 5148350Scael.Em not 5243631Sbosticterminating 5348350Scael.Fa dst 5443631Sbosticif 5548350Scael.Fa src 5643631Sbosticis more than 5748350Scael.Fa len 5843631Sbosticcharacters long. 5948350Scael.Sh RETURN VALUES 6048350ScaelThe 6148350Scael.Fn strcpy 6243631Sbosticand 6348350Scael.Fn strncpy 6448350Scaelfunctions 6543631Sbosticreturn 6648350Scael.Fa dst . 6748350Scael.Sh EXAMPLES 6848350ScaelThe following sets 6948350Scael.Dq Li chararray 7048350Scaelto 7148350Scael.Dq Li abc\e0\e0\e0 : 7248350Scael.Bd -literal -offset indent 7343631Sbostic(void)strncpy(chararray, "abc", 6). 7448350Scael.Ed 7548350Scael.Pp 7648350ScaelThe following sets 7748350Scael.Dq Li chararray 7848350Scaelto 7948350Scael.Dq Li abcdef : 8048350Scael.Bd -literal -offset indent 8143631Sbostic(void)strncpy(chararray, "abcdefgh", 6); 8248350Scael.Ed 8348350Scael.Sh SEE ALSO 8448350Scael.Xr bcopy 3 , 8548350Scael.Xr memccpy 3 , 8648350Scael.Xr memcpy 3 , 8748350Scael.Xr memmove 3 8848350Scael.Sh STANDARDS 8948350ScaelThe 9048350Scael.Fn strcpy 9143631Sbosticand 9248350Scael.Fn strncpy 9348350Scaelfunctions 9448350Scaelconform to 9548350Scael.St -ansiC . 96