memccpy, memchr, memcmp, memcpy, memmove, memset – memory operations
void* memccpy(void *s1, void *s2, int c, ulong n)
void* memchr(void *s, int c, ulong n)
int memcmp(void *s1, void *s2, ulong n)
void* memcpy(void *s1, void *s2, ulong n)
void* memmove(void *s1, void *s2, ulong n)
void* memset(void *s, int c, ulong n)
These functions operate efficiently on memory areas
(arrays of bytes bounded by a count, not terminated by a zero byte).
They do not check for the overflow of any receiving memory area.
copies bytes from memory area
stopping after the first occurrence of byte
has been copied, or after
bytes have been copied, whichever comes first.
It returns a pointer to the byte after
the copy of
or zero if
was not found in the first
returns a pointer to the first
occurrence of byte
in the first
bytes of memory area
or zero if
does not occur.
compares its arguments, looking at the first
bytes only, and returns an integer
less than, equal to, or greater than 0,
is lexicographically less than, equal to, or
The comparison is bytewise unsigned.
bytes from memory area
except that it is guaranteed to work if
sets the first
bytes in memory area
to the value of byte
All these routines have portable C implementations in
Most also have machine-dependent assembly language implementations in
ANSI C does not require
to handle overlapping source and destination; on Plan 9, it does, so
are handed a negative count, they abort.