1*48350Scael.\" Copyright (c) 1990, 1991 The Regents of the University of California. 241973Sbostic.\" All rights reserved. 341973Sbostic.\" 441973Sbostic.\" This code is derived from software contributed to Berkeley by 541973Sbostic.\" Chris Torek. 641973Sbostic.\" %sccs.include.redist.man% 741973Sbostic.\" 8*48350Scael.\" @(#)strcpy.3 5.3 (Berkeley) 04/19/91 941973Sbostic.\" 10*48350Scael.Dd 11*48350Scael.Dt STRCPY 3 12*48350Scael.Os BSD 4 13*48350Scael.Sh NAME 14*48350Scael.Nm strcpy 15*48350Scael.Nd copy strings 16*48350Scael.Sh SYNOPSIS 17*48350Scael.Fd #include <string.h> 18*48350Scael.Ft char * 19*48350Scael.Fn strcpy "char *dst" "const char *src" 20*48350Scael.Ft char * 21*48350Scael.Fn strncpy "char *dst" "const char *src" "size_t len" 22*48350Scael.Sh DESCRIPTION 23*48350ScaelThe 24*48350Scael.Fn strcpy 2543631Sbosticand 26*48350Scael.Fn strncpy 27*48350Scaelfunctions 28*48350Scaelcopy the string 29*48350Scael.Fa src 3041973Sbosticto 31*48350Scael.Fa dst 32*48350Scael(including the terminating 33*48350Scael.Ql \e0 34*48350Scaelcharacter). 35*48350Scael.Pp 36*48350ScaelThe 37*48350Scael.Fn strncpy 38*48350Scaelcopies not more than 39*48350Scael.Fa len 4043631Sbosticcharacters into 41*48350Scael.Fa dst , 42*48350Scaelappending 43*48350Scael.Ql \e0 44*48350Scaelcharacters if 45*48350Scael.Fa src 4643631Sbosticis less than 47*48350Scael.Fa len 4843631Sbosticcharacters long, and 49*48350Scael.Em not 5043631Sbosticterminating 51*48350Scael.Fa dst 5243631Sbosticif 53*48350Scael.Fa src 5443631Sbosticis more than 55*48350Scael.Fa len 5643631Sbosticcharacters long. 57*48350Scael.Sh RETURN VALUES 58*48350ScaelThe 59*48350Scael.Fn strcpy 6043631Sbosticand 61*48350Scael.Fn strncpy 62*48350Scaelfunctions 6343631Sbosticreturn 64*48350Scael.Fa dst . 65*48350Scael.Sh EXAMPLES 66*48350ScaelThe following sets 67*48350Scael.Dq Li chararray 68*48350Scaelto 69*48350Scael.Dq Li abc\e0\e0\e0 : 70*48350Scael.Bd -literal -offset indent 7143631Sbostic(void)strncpy(chararray, "abc", 6). 72*48350Scael.Ed 73*48350Scael.Pp 74*48350ScaelThe following sets 75*48350Scael.Dq Li chararray 76*48350Scaelto 77*48350Scael.Dq Li abcdef : 78*48350Scael.Bd -literal -offset indent 7943631Sbostic(void)strncpy(chararray, "abcdefgh", 6); 80*48350Scael.Ed 81*48350Scael.Sh SEE ALSO 82*48350Scael.Xr bcopy 3 , 83*48350Scael.Xr memccpy 3 , 84*48350Scael.Xr memcpy 3 , 85*48350Scael.Xr memmove 3 86*48350Scael.Sh STANDARDS 87*48350ScaelThe 88*48350Scael.Fn strcpy 8943631Sbosticand 90*48350Scael.Fn strncpy 91*48350Scaelfunctions 92*48350Scaelconform to 93*48350Scael.St -ansiC . 94