Previous Topic

Next Topic

NbrOfRecords

Get the number of active records in fixed length data file.

Short Name

DATENT()

Type

Low-level fixed-length data file function

Declaration

LONG NbrOfRecords(COUNT datno)

Description

NbrOfRecords() returns the number of active data records for the fixed length data file designated by datno.

Each time a new record is added to the file, the count of active records is incremented. Each time a record is deleted, the active count is decremented. A record is added by the low-level function NewData() or the ISAM function AddRecord(). A record is deleted by the low-level function ReleaseData() or the ISAM function DeleteRecord().

Return

If an error occurs or if there are no active data records, NbrOfRecords() returns a value of zero. Otherwise, NbrOfRecords() returns the number of active fixed data records in the data file. After a call to NbrOfRecords() returns a zero, check the value of uerr_cod: if uerr_cod is non-zero, an error condition was detected; otherwise, no active records are in the file. See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values.

Example

COUNT   datno;

scanf("%d",&datno);
printf("\nThere are %ld active records in file #%d.",
NbrOfRecords(datno),datno);

See also

NewData(), AddRecord(), DeleteRecord(), ReleaseData()