Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Returns the offset position of the first character of the specified line in the file in the specified editing window.
EDPOS _EdGetLinePos(WHANDLE wh, EDLINE theLine)
WHANDLE wh; /* Handle of editing window. */
EDLINE theLine; /* Line number. */
Example
The following example opens an editing session for a file specified by a parameter and gets the EDPOS for line 12 by calling _EdGetLinePos( ). It then calls _EdGetLineNum( ) on this EDPOS, and this returns 12. Next, it increments the EDPOS and each time calls _EdGetLineNum( ) until the EDLINE returned is changed. At this point, it calls _EdGetLinePos( ) for line 13.
Visual FoxPro Code
SET LIBRARY TO EDGETLPO
= EDGETLPOS("x")
C Code
#include <pro_ext.h>
void putLong(unsigned long n)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = 6;
_PutValue(&val);
}
FAR Example(ParamBlk FAR *parm)
{
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))
WHANDLE wh;
EDENV EdEnv;
EDPOS edpos;
EDLINE edlin, original;
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_READONLY);
_HUnLock(parm->p[0].val.ev_handle);
edpos = _EdGetLinePos(wh, 12);
_PutStr("\n_EdGetLinePos(wh, 12) =");
putLong(edpos);
original = edlin = _EdGetLineNum(wh, edpos);
for (;;)
{
_PutStr("\n_EdGetLineNum(wh,");
putLong(edpos);
_PutStr(") = ");
putLong(edlin);
if (edlin != original)
{
break;
}
edpos++;
edlin = _EdGetLineNum(wh, edpos);
}
edpos = _EdGetLinePos(wh, 13);
_PutStr("\n_EdGetLinePos(wh, 13) ="); putLong(edpos);
}
FoxInfo myFoxInfo[] = {
{"EDGETLPOS", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};
See Also
_EdGetLineNum( ) API Library Routine | _EdGetPos( ) API Library Routine | _EdGetChar( ) API Library Routine