DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

memory(S-osr5)


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

Syntax

cc . . . -lc

#include <string.h>

void *memccpy (s1, s2, c, n) void *s1; const void *s2; int c; size_t n;

void *memchr (s, c, n) const void *s; int c; size_t n;

int memcmp (s1, s2, n) const void *s1, *s2; size_t n;

void *memcpy (s1, s2, n) void *s1; const void *s2; size_t n;

void *memset (s, c, n) void *s; int c; size_t n;

Description

memccpy- copies characters from memory area

memchr- returns a pointer to the first occurrence of a character

memcmp- compares arguments

memcpy- copies n characters

memset- sets the first n characters in memory area

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.

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.

memcmp compares its arguments, looking at the first n characters only, 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 characters from memory area s2 to s1. It returns s1.

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

Notes

memcmp is implemented by using the most natural character comparison on the machine. Thus the sign of the value returned when one of the characters has its high order bit set is not the same in all implementations and should not be relied upon.

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

Although the <memory.h> header file still exists, the <string.h> header file should be used.

Standards conformance

memccpy is conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992 ;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) .

memchr, memcmp, memcpy and memset are conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, 1992 ;
ANSI X3.159-1989 Programming Language -- C ;
and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005