JavaScript Editor js editor     Web development 

Main Page

Moves the insertion point to the specified offset position in the file in the specified editing window, unselecting any selected text.

void _EdSetPos(WHANDLE wh, EDPOS thePos)
WHANDLE wh;            /* Handle of editing window. */
EDPOS thePos;               /* Specified offset position. */


The following example opens for editing a file specified by a parameter. Using _EdSetPos(В ), it sets the insertion point to position 19 of the file. It calls _EdGetPos(В ) and inserts some text to verify that the insertion point has been set.

Visual FoxPro Code

В Copy Code

C Code

В Copy Code
#include <pro_ext.h>

void putLong(long n)
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 6;


FAR Example(ParamBlk FAR *parm)
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

   WHANDLE wh;
   EDPOS edpos;

   if (!_SetHandSize(parm->p[0].val.ev_handle, 
      _Error(182); // "Insufficient memory"
   pFILENAME[parm->p[0].val.ev_length] = '\0';

   wh = _EdOpenFile(pFILENAME, FO_READWRITE);

   _EdSetPos(wh, 19);
   _PutStr("\n_EdSetPos(wh, 19)");
   edpos = _EdGetPos(wh);
   _PutStr("\n_EdGetPos(wh) ="); putLong(edpos);
   _EdInsert(wh, "*** Inserted at EDPOS = 19 ***",
      _StrLen("*** Inserted at EDPOS = 19 ***"));

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

See Also

JavaScript Editor js editor     Web development