_EdOpenFile( ) API Library Routine Example
The following example opens an editor session for a file specified by a parameter.
SET LIBRARY TO EDOPEN
= EDOPEN("x") && opens editor session for file "x"
#include <pro_ext.h>
FAR Example(ParamBlk FAR *parm)
{
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))
WHANDLE wh;
if (!_SetHandSize(parm->p[0].val.ev_handle,
parm->p[0].val.ev_length+1))
{
_Error(182); // "Insufficient memory"
}
pFILENAME[parm->p[0].val.ev_length] = '\0';
_HLock(parm->p[0].val.ev_handle);
wh = _EdOpenFile(pFILENAME, FO_READWRITE);
_HUnLock(parm->p[0].val.ev_handle);
}
FoxInfo myFoxInfo[] = {
{"EDOPEN", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};