DELFILX
Delete FairCom DB file to the recycle bin.
Type
Low-Level function
Declaration
COUNT DELFILX(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
DELFILX() deletes the file opened with file number filno to a recycle bin, if and only if the file has been opened in the ctEXCLUSIVE mode. The file is closed by FairCom DB before it is deleted.
optionBits bit field values:
typedef enum ctDeleteFileOptionsBits_t {
ctDELETE_TO_RECYCLE_BIN = 0x00000001 /* move files to recycle bin instead of deleting */
} ctDELETE_FILE_OPTIONS_BITS;
typedef struct ctDeleteFileOptions_t {
UCOUNT structVersion; /* [IN] version of this structure */
UCOUNT pad; /* unused padding */
ULONG optionBits; /* [IN] option bits */
} ctDELETE_FILE_XTD_OPTIONS, *pctDELETE_FILE_XTD_OPTIONS;
Any FairCom DB file may be deleted with DELFILX(), 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 (DELFILX(tempno)) {
printf("\nCould not delete temporary file (%d)\n", uerr_cod);
Limitations
DELFILX() 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).
See also
DeleteCtFile, DeleteIFile, DeleteRFile, DELIFILX, and DELRFILX