memory(3c) DG/UX 4.30 memory(3c)
NAME
memccpy, memchr, memcmp, memcpy, memmove, memset - memory
operations
SYNOPSIS
#include <memory.h>
void *memccpy (s1, s2, c, n)
void *s1, *s2;
int c, n;
void *memchr (s, c, n)
void *s;
int c;
sizet n;
int memcmp (s1, s2, n)
void *s1, *s2;
sizet n;
void *memcpy (s1, s2, n)
void *s1, *s2;
sizet n;
void *memmove (s1, s2, n)
void *s1, *s2;
sizet n;
void *memset (s, c, n)
void *s;
int c;
sizet n;
DESCRIPTION
These functions operate as efficiently as possible on memory
areas (arrays of characters bounded by a count, not
terminated by a null character). They do not check for the
overflow of any receiving memory area. The return types
given above for pointers s1 and s2 (void *) are for ANSI C.
In traditional C, the return types are char *.
Memccpy copies characters from memory area s2 into s1,
stopping after the first occurrence of character c has been
copied, or after n characters have been copied, whichever
comes first. It returns a pointer to the character after
the copy of c in s1, or a NULL pointer if c was not found in
the first n characters of s2.
Memchr returns a pointer to the first occurrence of
character c in the first n characters of memory area s, or a
NULL pointer if c does not occur.
Licensed material--property of copyright holder(s) Page 1
memory(3c) DG/UX 4.30 memory(3c)
Memcmp compares its arguments, looking at the first n
characters only, and returns an integer less than, equal to,
or greater than 0, according to whether s1 is
lexicographically less than, equal to, or greater than s2.
Memcpy copies n characters from memory area s2 to s1; it
returns s1. If s1 and s2 overlap, the behavior is
undefined.
Memmove copies n characters from memory area s2 to s1; it
returns s1. Effectively, memmove copies first to a
temporary area, then to the target area, so memmove can
safely be used on overlapping s1 and s2.
Memset sets the first n characters in memory area s to the
value of character c. It returns s.
NOTE
For user convenience, all these functions are declared in
the optional memory.h header file.
BUGS
The sign of the value returned when one of the characters
has its high-order bit set is implementation-dependent.
Character movement is performed differently in different
implementations. Thus overlapping moves may yield
surprises.
Licensed material--property of copyright holder(s) Page 2