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 variabl 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.

Access Tips

FoxPro Tips

General Tips

 

Related Items

FoxPro Functions

FoxPro has always had functions like FREAD and FWRITE to read and write files at a low level. They can handle files which defeat the STRTOFILE and FILETOSTR functions.

Read More

Functions for manipulating text in FoxPro

Foxpro commands and functions for text

Read More

Create a low level file with FoxPro

Use FCREATE() to create a low level file in FoxPro

Read More

Open a low level file in FoxPro

Use FOPEN() to open a low level file in FoxPro

Read More

Read from a low level file in FoxPro

Use FREAD() to read data from a low level file in FoxPro

Read More