Previous Topic

Next Topic

DeleteCtFile

Delete c-tree Plus file.

Short Name

DELFIL()

Type

Low-level function

Declaration

COUNT DeleteCtFile(COUNT filno)

Description

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 c-tree Plus before it is deleted.

Any c-tree Plus 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 c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

COUNT        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).