Function FClose() Foundation

Closes an open binary file.

Syntax
FClose( <nHandle> ) --> lError
Parameters
<nHandle>
<nHandle> is an integer numeric value (file handle) returned from FOpen() or FCreate() when the file is opened.
Return

The return value of FClose() is .T. (true) when a file was closed, otherwise it is .F. (false).

Description

The low level file function FClose() closes a file previously opened with the function FOpen() or FCreate(). FClose() causes all of the buffers belonging to the file to be written to the file (hard disk, diskette). If this write operation fails, FClose() returns the value .F. (false). The cause of error can be determined using the function FError().

Examples
FClose()
// In the example a file is closed with FClose(). 
// If an error occurs, the pertinent error code is 
// displayed. 

#include "Fileio.ch" 

PROCEDURE Main 
   LOCAL nHandle := FCreate("OPENTEST.TXT", FC_NORMAL) 

   IF ! FClose( nHandle ) 
      ? "An error occurred when closing the file: ", FError() 
   ENDIF 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.