Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

TestFileNbr

Determine the status of a file number.

Short Name

TSTFILNUM()

Type

Low-Level function

Declaration

COUNT TestFileNbr(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

TestFileNbr() returns zero if filno is not in use or returns FINT_ERR (47, c-tree 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 not initialized.

See c-tree Error Codes for a complete listing of valid c-tree 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.");

}

TOCIndex