Clib Get Cursor Position Method
The Clib Get Cursor Position method gets the current position of the file cursor in the file that the filePointer argument identifies. It stores this value in the position argument.
Format
Clib.fgetpos(filePointer, position)
The following table describes the arguments for the Get Pointer Position method.
Argument | Description |
---|---|
filePointer |
A file pointer that the Clib Open File method returns. |
position |
The current position of the pointer in the file that the filePointer argument identifies. |
Example
The following example restores the cursor position. It does the following work:
Writes two strings to a temporary text file.
To save the position where the second string begins, it uses the Clib Get Cursor Position method.
To set the file cursor to the saved position, it uses the Clib Set Cursor Position method:
function Test_Click () { var position; var fp = Clib.tmpfile(); Clib.fputs("Melody\n”, fp); Clib.fgetpos(fp, position) Clib.fputs("Lingers\n", fp); Clib.fsetpos(fp, position); var msg = Clib.fgets(fp)); Clib.fclose(fp); TheApplication().RaiseErrorText(msg); }