Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ memcmp(3) — NEWS-os 4.2.1R

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

string(3)

MEMORY(3)  —  NEWS-OS Programmer’s Manual

NAME

memccpy, memchr, memcmp, memcpy, memmove, memset − memory operations

SYNOPSIS

include <string.h>

char ∗memccpy (s1, s2, c, n)
char ∗s1, ∗s2;
int c, n;

char ∗memchr (s, c, n)
char ∗s;
int c, n;

int memcmp (s1, s2, n)
char ∗s1, ∗s2;
int n;

char ∗memcpy (s1, s2, n)
char ∗s1, ∗s2;
int n;

char ∗memmove (s1, s2, n)
char ∗s1, ∗s2;
int n;

char ∗memset (s, c, n)
char ∗s1, ∗s2;
int n;

DESCRIPTION

These functions operate as efficiently as possible on memory areas (arrays of bytes bounded by a count, not terminated by a NULL character).  They do not check for the overflow of any recieving memory area. 

memccpy() copies bytes from memory area s2 into s1, stopping after the first occurrence of byte c (converted to an unsigned char) has been copied, or after n bytes (each interpreted as unsigned char) have been copied, whichever comes first.  It returns a pointer to the byte after the copy of c in s1, or a NULL pointer if c was not found in the first n bytes of s2.

memchr() returns a pointer to the first occurrence of byte c (converted to an unsigned char) in the first n bytes (each interpreted as unsigned char) of memory area s, or a NULL pointer if c does not occur. 

memcmp() compares its arguments, looking at the first n bytes only (each interpreted as unsigned char), and returns an integer less than, equal to, or greater than 0, according as s1 is lexicographically less than, equal to, or greater than s2.

memcpy() copies n bytes from memory area s2 to s1. It returns s1.

memmove() copies n bytes from memory area s2 to s1. It returns s1. Copying takes place correctly even if the objects pointed to by s1 and s2 overlap. 

memset() sets the first n bytes in memory area s to the value of byte c. It returns s.

NOTE

for user convenience, all these functions are declared in the <string.h> header file. 

Bytes movement is performed differently in different implementations.  Thus overlapping moves may yield surprises. 

SEE ALSO

string(3)

NEWS-OSRelease 4.2.1R

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