_EdGetStr( ) (Rutina de biblioteca API)

Coloca el texto entre las posiciones de desplazamiento especificadas (incluidas éstas) de la dirección especificada.

void _EdGetStr(WHANDLE wh, EDPOS thePos, EDPOS thePos, 
               TEXT *theStr)
WHANDLE wh;            /* Handle of editing window. */
EDPOS thePos;               /* Starting offset position. */
EDPOS thePos;               /* Stopping offset position. */
TEXT *theStr;               /* Where to put the text. */

Ejemplo

El ejemplo siguiente toma como parámetro un nombre de archivo y devuelve los primeros 16 bytes de ese archivo.

Código Visual FoxPro

SET LIBRARY TO EDGETSTR
? EDGETSTR("x") && returns the first 16 characters of file "x"

Código C

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   WHANDLE wh;
   char FAR *buffer;
   char FAR *pFileName;

   if (!_SetHandSize(parm->p[0].val.ev_handle,
      parm->p[0].val.ev_length+1)) 
   {
      _Error(182); // "Insufficient memory"
   }
   _HLock(parm->p[0].val.ev_handle);
   pFileName = _HandToPtr(parm->p[0].val.ev_handle);
   pFileName[parm->p[0].val.ev_length] = '\0';
   wh = _EdOpenFile(pFileName, FO_READONLY);
   _HUnLock(parm->p[0].val.ev_handle);
   if ((buffer = _Alloca(17)) == 0) {
      _Error(182); // "Insufficient memory"
   }
   _EdGetStr(wh, 0, 15, buffer);
   buffer[16] = '\0';
   _RetChar(buffer);
}

FoxInfo myFoxInfo[] = {
   {"EDGETSTR", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

Vea también

_EdGetChar( ) (Rutina de biblioteca API) | _EdSetPos( ) (Rutina de biblioteca API) | _EdGetLinePos( ) (Rutina de biblioteca API)