DeleteCtFile
Delete FairCom DB file.
Short Name
DELFIL()
Type
Low-Level function
Declaration
COUNT DeleteCtFile(FILNO filno)
Description
In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering
DeleteCtFile() deletes the file opened with file number filno, if and only if the file has been opened in the ctEXCLUSIVE mode. The file is closed by FairCom DB before it is deleted.
Any FairCom DB file may be deleted with DeleteCtFile(), whether it has been opened or created with a Low-Level function, an ISAM parameter file, or with incremental ISAM structures; provided the file has been opened in ctEXCLUSIVE file mode.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful file deletion. |
55 |
DLTF_ERR |
File could not be deleted. Does any process have the file open? |
56 |
DLTP_ERR |
File is not opened in the ctEXCLUSIVE mode. Delete is not performed. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
FILNO tempno;
if (CreateDataFile(tempno = 5,"temp.dat",1004,0,ctEXCLUSIVE))
{
printf("\nCould not create temporary file (%d)\n", uerr_cod);
temporary_processing(tempno);
if (DeleteCtFile(tempno)) {
printf("\nCould not delete temporary file (%d)\n", uerr_cod);
Limitations
DeleteCtFile() first closes the file before deletion. This permits another process to have a small window of opportunity to gain control of the file in which case the delete will fail and result in an error DLTF_ERR (55).