Siebel eScript Language Reference > Siebel eScript Commands > File I/O Methods in eScript >

Clib.fgetpos() Method

This method stores the current position of the pointer in a file.


Clib.fgetpos(filePointer, position)



A file pointer as returned by Clib.fopen()


The current position of filePointer


0 if successful; otherwise, nonzero, in which case an error value is stored in the errno property.


This method stores the current position of the file cursor in the file indicated by filePointer for future restoration using fsetpos(). The file position is stored in the variable position; use it with fsetpos() to restore the cursor to its position.


This example writes two strings to a temporary text file, using Clib.fgetpos() to save the position where the second string begins. The program then uses Clib.fsetpos() to set the file cursor to the saved position so as to display the second string.

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);

See Also

Clib.feof() Method
Clib.fsetpos() Method
Clib.ftell() Method

Siebel eScript Language Reference