JavaScript Editor js editor     Web development 

Main Page

Replaces the memory variable specified by loc with the value val.

int _Store(Locator FAR *loc, Value FAR *val)
Locator FAR *loc;            /* Memory variable locator. */
Value FAR *val;               /* Value to store. */


Reference individual array elements by setting l_subs to the number of subscripts you specified and l_sub1 and l_sub2 to the actual subscripts. The first element of an array is numbered 1. If loc specifies an array and l_subs is 0, _Store(В ) stores the value in val to all elements in the array.

_Store(В ) returns 0 if it is successful. If it fails, _Store(В ) returns a negative integer whose absolute value is a Visual FoxPro error number. If _Store(В ) runs out of memory while storing to an array, some values of some array elements may have been set, and others may not have been.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.


The following example converts to uppercase a string argument passed by reference.

Visual FoxPro Code

В Copy Code
x = "abc"
= XUPPER(@x)
? x

C Code

В Copy Code
#include <pro_ext.h>

void FAR Upper(ParamBlk FAR *parm)
      char FAR *pString;
      Value val;
      int i;
//   _Load() and _Store are the functions of interest for pass-by-reference.
   _Load(&parm->p[0].loc, &val);
//   FoxPro doesn't check the type of pass-by-reference arguments, so we do.
   if (val.ev_type != 'C') {
      _Error(9); // "Data type mismatch"
  pString = _HandToPtr(val.ev_handle);

   for (i = 0; i < val.ev_length; i++)  {
      if ('a' <= *pString && *pString <= 'z') {
         *pString += ('A' - 'a');
   _Store(&parm->p[0].loc, &val);
   // We need to free the handle that we created with  _LOAD()

FoxInfo myFoxInfo[] = {
   {"XUPPER", (FPFI) Upper, 1, "R"},
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

See Also

JavaScript Editor js editor     Web development