Previous Topic

Next Topic

TestFileNbr

Determine the status of a file number.

Short Name

TSTFILNUM()

Type

Low-level function

Declaration

COUNT TestFileNbr(COUNT filno)

Description

TestFileNbr() returns zero if filno is not in use or returns FINT_ERR (47, c-tree Plus not initialized), FNUM_ERR (22, filno is out of range), or FUSE_ERR (46, filno is in use). TestFileNbr() does NOT set or change uerr_cod.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

File number not in use.

22

FNUM_ERR

filno is out of range.

46

FUSE_ERR

filno is in use.

47

FINT_ERR

c-tree Plus not initialized.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

COUNT    retval;

if (retval = InitISAM(6,7,4))
    printf("\nCould not initialize. Error %d.", retval);
else {
    if ((retval = TestFileNbr(5)) == 0) {
        if (OpenRFile(5, "MyFile.dat"))
            printf("\nCould not open files.");
    {
    else if (retval == 46)
        if (OpenRFile(-1, "MyFile.dat"))
            printf("\nCould not open files.");
    if (CloseISAM())
        printf("\nCould not close ISAM.");
}