Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >
Clib.fgetpos() Method
This method stores the current position of the pointer in a file.
Syntax
Clib.fgetpos(filePointer, position)
Parameter Description filePointer A file pointer as returned by Clib.fopen() position The current position of filePointerReturns
0 if successful; otherwise, nonzero, in which case an error value is stored in the errno property.
Usage
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.
Example
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, as shown in the illustration.
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);
TheApplication().RaiseErrorText(Clib.fgets(fp));
Clib.fclose(fp);
}See Also
Clib.feof() Method, Clib.fsetpos() Method, and Clib.ftell() Method
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |