Chapter Contents |
Previous |
Next |
memfil |
Portability: | SAS/C extension |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
CAUTION | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <lcstring.h> void *memfil(void *to, const void *from, size_t n, size_t len);
DESCRIPTION |
memfil
fills a block of memory (indicated by
to
)
with the contents of the array
from
. The
argument
n
specifies the length of the
area to be filled, while
len
specifies
the size of the fill sequence. The area length does not have to be evenly
divisible by the string length, in which case only a portion of the sequence
is included in the final copy. Null characters in the fill sequence are treated
like any other character.
RETURN VALUE |
memfil
returns the address of the
to
area.
CAUTION |
The third argument to
memfil
has type
size_t
. If a negative
number is passed, massive overlaying of memory occurs. (The fourth argument
also has type
size_t
, but specification
of a negative value here may produce incorrect results, but overlaying of
memory will not occur.)
If the fill string and the target area overlap, the
effect of
memfil
is undefined. If the string
length is 0, the target area is not changed.
IMPLEMENTATION |
memfil
uses the MVCL instruction to propagate characters through memory. MVCL also
copies the fill string to the target unless the fill string is longer than
256 bytes, in which case
memcpy
is called
to do this.
EXAMPLE |
#include <lcstring.h> int minus2 = -2; int values[100] [100]; /* Set all array elements to -2. */ memfil(values, &minus2, sizeof(values), sizeof(int));
RELATED FUNCTIONS |
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.