|
|
1.1 root 1: .TH MEMORY 3
2: .CT 2 mem_man
3: .SH NAME
4: memccpy, memchr, memcmp, memcpy, memmove, memset \(mi memory operations
5: .SH SYNOPSIS
6: .nf
7: .B char *memccpy(s1, s2, c, n)
8: .B char *s1, *s2;
9: .B int c, n;
10: .PP
11: .B char *memchr(s, c, n)
12: .B char *s;
13: .B int c, n;
14: .PP
15: .B int memcmp(s1, s2, n)
16: .B char *s1, *s2;
17: .B int n;
18: .PP
19: .B char *memcpy(s1, s2, n)
20: .B char *s1, *s2;
21: .B int n;
22: .PP
23: .B char *memmove(s1, s2, n)
24: .B char *s1, *s2;
25: .B int n;
26: .PP
27: .B char *memset(s, c, n)
28: .B char *s;
29: .B int c, n;
30: .fi
31: .SH DESCRIPTION
32: These functions operate efficiently on memory areas
33: (arrays of characters bounded by a count, not terminated by a null character).
34: They do not check for the overflow of any receiving memory area.
35: .PP
36: .I Memccpy
37: copies characters from memory area
38: .I s2
39: into
40: .IR s1 ,
41: stopping after the first occurrence of character
42: .I c
43: has been copied, or after
44: .I n
45: characters have been copied, whichever comes first.
46: It returns a pointer to the character after
47: the copy of
48: .I c
49: in
50: .IR s1 ,
51: or zero if
52: .I c
53: was not found in the first
54: .I n
55: characters of
56: .IR s2 .
57: .PP
58: .PP
59: .I Memchr
60: returns a pointer to the first
61: occurrence of character
62: .I c
63: in the first
64: .I n
65: characters of memory area
66: .IR s,
67: or zero if
68: .I c
69: does not occur.
70: .PP
71: .I Memcmp
72: compares its arguments, looking at the first
73: .I n
74: characters only, and returns an integer
75: less than, equal to, or greater than 0,
76: according as
77: .I s1
78: is lexicographically less than, equal to, or
79: greater than
80: .IR s2 .
81: .PP
82: .I Memcpy
83: copies
84: .I n
85: characters from memory area
86: .I s2
87: to
88: .I s1.
89: It returns
90: .I s1.
91: .PP
92: .I Memmove
93: is the same as
94: .I memcpy,
95: except it is guaranteed to handle overlapping strings as
96: if the move had been made to a temporary and then to the destination.
97: .PP
98: .I Memset
99: sets the first
100: .I n
101: characters in memory area
102: .I s
103: to the value of character
104: .IR c .
105: It returns
106: .IR s .
107: .SH SEE ALSO
108: .IR string (3)
109: .SH BUGS
110: .I Memcmp
111: uses native character comparison, which is signed
112: on some machines, unsigned on others;
113: thus the sign of the value returned when a
114: character has its high-order bit set is implementation-dependent.
115: .br
116: Thanks to ANSI X3J11 for the
117: .IR memcpy/memmove
118: distinction.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.