Siebel eScript Language Reference > Siebel eScript Commands > File I/O Methods in eScript >
Clib.fclose() Method
This method writes a file's data to disk and closes the file. Syntax
Clib.fclose(filePointer)
|
|
filePointer |
A file pointer as returned by Clib.fopen() |
Returns
Zero if successful; otherwise, returns EOF. Usage
This method flushes the file's buffers (that is, writes its data to disk) and closes the file. The file pointer ceases to be valid after this call. Example
This example creates and writes to a text file and closes the file, testing for an error condition at the same time. If an error occurs, a message is displayed and the buffer is flushed. 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'); }
See Also
Clib.fflush() Method
|