Siebel eScript Language Reference > C Language Library Reference > Clib File and Directory Methods >

Clib Close File Method


The Clib Close File method writes to disk the data that currently resides in the buffer for a file. It then closes this file. It returns one of the following values:

  • If successful, then it returns the following value:

    Zero

  • If not successful, then it returns the following value:

    EOF

The file pointer is no longer valid after this call.

Format

Clib.fclose(filePointer)

The arguments for this method are the same as the arguments for the Clib Clear Error method. For more information, see Arguments for the Clib Clear Error Method.

Example

The following example creates and writes to a text file, and then closes this file. It also tests for an error condition. If an error occurs, then it displays a message and clears the buffer:

function Test_Click ()
{
   var fp = Clib.fopen('c:\\temp000.txt', 'wt');
   Clib.fputs('abcdefg\nABCDEFG\n', fp);
   if (Clib.fclose(fp) != 0)
   {
      TheApplication().RaiseErrorText('Unable to close file.' +
         '\nContents are lost.');
   }
   else
      Clib.remove('c:\\temp000.txt');
}

For more information, see Clib Clear Buffer Method.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.