Close a low level file in FoxPro

Use the FCLOSE (<filehandle>) function to close a file that has been opened with FOPEN() . This will attempt to save your changes. It will return .T. if the file can be closed successfully and .F. if it cannot.

The CLOSE ALL command will close all low level files.

A file handle is essential for these low level functions and it is usual to hold it in a local variable. You must close the file before this variable goes out of scope. Once the file has been opened (or created) it will remain open and locked to other users until it is closed.

The file will remain open even if the variable holding its handle has been overwritten or released. If you wait until you have lost the value of the handle then you will not be able to use FCLOSE to close that specific file.

More tips from Alvechurch Data

More tips from Alvechurch Data

FoxPro Functions

The FREAD and FWRITE functions are more flexible than STRTOFILE and FILETOSTR.

Read More

FoxPro low level files

Using FOPEN() in FoxPro to open a low level file.

Read More

FoxPro low level files

Using FREAD() in FoxPro to read from a low level file.

Read More