Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >

Clib.fgets() Method


This method returns a string consisting of the characters in a file from the current file cursor to the next newline character.

Syntax

Clib.fgets([maxLen,] filePointer)

Parameter
Description
maxLen
The maximum length of the string to be returned if no newline character is encountered; if the File Mode is Unicode, the length argument is the length in Unicode characters.
filePointer
A file pointer as returned by Clib.fopen()

Returns

A string consisting of the characters in a file from the current file cursor to the next newline character. If an error occurs, or if the end of the file is reached, null is returned.

Usage

This method returns a string consisting of the characters in a file from the current file cursor to the next newline character. The newline is returned as part of the string.

Example

This example writes a string containing an embedded newline character to a temporary file. It then reads from the file twice to retrieve the output and display it, as shown in the illustration following the example.

function Test_Click ()
{
   var x = Clib.tmpfile();
   Clib.fputs("abcdefg\nABCDEFG\n", x);
   Clib.rewind(x);
   TheApplication().RaiseErrorText(Clib.fgets(x) + " " + Clib.fgets(x));
   Clib.fclose(x);
}

See Also

Clib.fputs() Method


 Siebel eScript Language Reference 
 Published: 18 April 2003