Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ memory(3) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

string

swab



MEMORY(3,F)                 AIX Technical Reference                 MEMORY(3,F)



-------------------------------------------------------------------------------
memory: memccpy, memchr, memcmp, memcpy, memset, bcopy



PURPOSE

Performs memory operations.

LIBRARY

Standard C Library (libc.a)

SYNTAX

#include <string.h>
#include <memory.h>




   char *memccpy (target, source, c, n)    char *memcpy (target, source, n)
   char *target, *source;                  char *target, *source;
   int c;                                  size_t n;
   size_t n;
                                           char *memset (s, c, n)
   char *memchr (s, c, n)                  char *s;
   char *s;                                int c;
   int c;                                  size_t n;
   size_t n;
                                           void bcopy (source, target, n)
   int memcmp (target, source, n)          char *source, *target;
   void *target, *source;                  int n;
   size_t n;



DESCRIPTION

The memory subroutines operate on memory areas.  A memory area is an array of
characters bounded by a count, and not terminated by a null character.  The
memory subroutines do not check for the overflow of any receiving memory area.
All of the memory subroutines are declared in the memory.h header file.

The memccpy subroutine copies characters from memory area source into memory
area target.  The memccpy subroutine stops after the first character c is
copied, or after n characters have been copied, whichever comes first.  memccpy
returns a pointer to the character after c is copied into target, or a NULL
pointer if c is not found in the first n characters of source.






Processed November 7, 1990        MEMORY(3,F)                                 1





MEMORY(3,F)                 AIX Technical Reference                 MEMORY(3,F)



The memchr subroutine 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.

The memcmp subroutine lexicographically compares the first n characters in
memory area target to the first n characters in memory area source.  memcmp
uses native character comparison, which may be signed on some machines.  The
memcmp subroutine returns the following values:

Less than 0       If target is less than source
Equal to 0        If target is equal to source
Greater than 0    If target is greater than source.

The memcpy subroutine copies n characters from memory area source to area
target and returns target.  This routine does not correctly handle overlapped
copies.

The memset subroutine sets the first n characters in memory area s to the value
of character c and returns s.

Like the memcpy subroutine, the bcopy subroutine copies n characters from
memory area source to area target.  However, bcopy handles overlaps.  The order
of the parameters is reversed for bcopy, with source being specified first.
This subroutine has no return values.

Warning:  Character movement is performed differently in different
implementations of these subroutines; therefore, overlapping moves may yield
unexpected results.

RELATED INFORMATION

In this book:  "string" and "swab."























Processed November 7, 1990        MEMORY(3,F)                                 2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026