|
|
1.1 ! root 1: .\" Copyright (c) 1990 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" This code is derived from software contributed to Berkeley by ! 5: .\" Chris Torek. ! 6: .\" ! 7: .\" Redistribution and use in source and binary forms are permitted provided ! 8: .\" that: (1) source distributions retain this entire copyright notice and ! 9: .\" comment, and (2) distributions including binaries display the following ! 10: .\" acknowledgement: ``This product includes software developed by the ! 11: .\" University of California, Berkeley and its contributors'' in the ! 12: .\" documentation or other materials provided with the distribution and in ! 13: .\" all advertising materials mentioning features or use of this software. ! 14: .\" Neither the name of the University nor the names of its contributors may ! 15: .\" be used to endorse or promote products derived from this software without ! 16: .\" specific prior written permission. ! 17: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 18: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 19: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 20: .\" ! 21: .\" @(#)strcpy.3 5.2 (Berkeley) 6/24/90 ! 22: .\" ! 23: .TH STRCPY 3 "June 24, 1990" ! 24: .UC 4 ! 25: .SH NAME ! 26: strcpy \- copy strings ! 27: .SH SYNOPSIS ! 28: .nf ! 29: .ft B ! 30: #include <string.h> ! 31: ! 32: char * ! 33: strcpy(char *dst, const char *src); ! 34: ! 35: char * ! 36: strncpy(char *dst, const char *src, size_t len); ! 37: .ft R ! 38: .fi ! 39: .SH DESCRIPTION ! 40: .B Strcpy ! 41: and ! 42: .B strncpy ! 43: copy string ! 44: .I src ! 45: to ! 46: .IR dst , ! 47: stopping after the terminating '\e0' has been moved. ! 48: .PP ! 49: .B Strncpy ! 50: writes exactly ! 51: .I len ! 52: characters into ! 53: .IR dst , ! 54: appending '\e0' characters if ! 55: .I src ! 56: is less than ! 57: .I len ! 58: characters long, and ! 59: .I not ! 60: terminating ! 61: .I dst ! 62: if ! 63: .I src ! 64: is more than ! 65: .I len ! 66: characters long. ! 67: .PP ! 68: .B Strcpy ! 69: and ! 70: .B strncpy ! 71: return ! 72: .IR dst . ! 73: .SH EXAMPLES ! 74: The following sets ``chararray'' to ``abc\e0\e0\e0'': ! 75: .sp ! 76: .ti +0.5i ! 77: (void)strncpy(chararray, "abc", 6). ! 78: .PP ! 79: The following sets ``chararray'' to ``abcdef'': ! 80: .sp ! 81: .RS ! 82: (void)strncpy(chararray, "abcdefgh", 6); ! 83: .RE ! 84: .SH SEE ALSO ! 85: bcopy(3), memccpy(3), memcpy(3), memmove(3) ! 86: .SH STANDARDS ! 87: .B Strcpy ! 88: and ! 89: .B strncpy ! 90: conform to ANSI X3.159-1989 (``ANSI C'').
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.