Make all bucket and overflow addresses unsigned
[unix-history] / usr / src / lib / libc / string / strncpy.3
CommitLineData
41b85a03
KB
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.\" %sccs.include.redist.man%
8.\"
9.\" @(#)strncpy.3 5.1 (Berkeley) %G%
10.\"
11.TH STRNCPY 3 ""
12.UC 4
13.SH NAME
14strncpy \- copy strings of limited length
15.SH SYNOPSIS
16.nf
17.ft B
18#include <string.h>
19
20char *
21strncpy(char *dst, const char *src, size_t len);
22.ft R
23.fi
24.SH DESCRIPTION
25.B Strncpy
26writes exactly
27.I len
28characters into
29.I dst
30by copying string
31.I src
32to
33.IR dst ,
34appending '\e0' characters if
35.I src
36is less than
37.I len
38characters long, and
39.I not
40terminating
41.I dst
42if
43.I src
44is more than
45.I len
46characters long.
47.B Strncpy
48returns
49.IR dst .
50.SH EXAMPLES
51The following sets ``chararray'' to ``abc\e0\e0\e0'':
52.sp
53.ti +0.5i
54(void)strncpy(chararray, "abc", 6).
55.PP
56The following sets ``chararray'' to ``abcdef'':
57.sp
58.RS
59(void)strncpy(chararray, "abcdefgh", 6);
60.RE
61.SH SEE ALSO
62bcopy(3), memccpy(3), memcpy(3), memmove(3), strcpy(3)
63.SH STANDARDS
64.B Strncpy
65conforms to ANSI X3.159-1989 (``ANSI C'').