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.

MS Access technical tips

Visual FoxPro technical tips

General Tips

 

More tips from Alvechurch Data

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

FoxPro functions for manipulating text

Foxpro commands and functions for text

Read More

Create a low level file with FoxPro

FoxPro file handling - use FCREATE() to create a low level file

Read More

Open a low level file in FoxPro

FoxPro file handling - use FOPEN() to open a low level file

Read More

Read from a low level file in FoxPro

FoxPro file handling - use FREAD() to read data from a low level file

Read More