#include <lcstring.h> void *memfil(void *to, const void *from, size_t n, size_t len);
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.
memfil
returns the address of the to
area.
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.
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.
#include <lcstring.h> int minus2 = -2; int values[100] [100]; /* Set all array elements to -2. */ memfil(values, &minus2, sizeof(values), sizeof(int));
memset
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.