JavaScript Editor js editor     Web development 

Main Page

Fills an area of memory starting at the location pointed to by ptr with length copies of the byte in character.

void _MemFill(void FAR *ptr, int character, unsigned int length)
void FAR *ptr;               /* Starting point for fill. */
int character;               /* Character for fill. */
unsigned int length;         /* How many bytes to fill. */


The following example uses _MemFill(В ) to duplicate the functionality of the Visual FoxPro function REPLICATE(В ).

Visual FoxPro Code

В Copy Code
x = xREPLICATE("x", 120)
? x
? LEN(x)

C Code

В Copy Code
#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
   char FAR *rep;
   char c = *(char *) _HandToPtr(parm->p[0].val.ev_handle);

   rep = _Alloca((int) parm->p[1].val.ev_long + 1);

   _MemFill(rep, c, (int) parm->p[1].val.ev_long);

  rep[parm->p[1].val.ev_long] = '\0';
FoxInfo myFoxInfo[] = {
   {"XREPLICATE", (FPFI) Example, 2, "C,I"},
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

See Also

JavaScript Editor js editor     Web development