Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ReadData

Read fixed-length data record.

Short Name

REDREC()

Type

Low-Level data file function

Declaration

COUNT ReadData(FILNO datno, LONG recbyt, pVOID recptr)

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

ReadData() reads the data record at byte position recbyt for data file datno into the buffer area pointed to by recptr. If datno refers to a variable-length file, ReadData() reads only the fixed-length portion into the buffer. Use ReReadVRecord() to read an entire variable-length record.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful read.

29

ZREC_ERR

Attempt to read at byte offset zero.

30

LEOF_ERR

recbyt exceeds the logical end of file maintained in the data file header.

33

DNUL_ERR

recptr is NULL.

35

SEEK_ERR

lseek() failed while preparing for read.

36

READ_ERR

Operating system could not execute read.

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

Example

FILNO datno,keyno;

TEXT recptr[1024];

LONG part_number;


scanf("%ld",&part_number);

if (ReadData(datno, GetKey(keyno, &part_number), recptr))

printf("\nCould not retrieve record for part #%ld", part_number);

Limitations

The recbyt parameter in this function is a 4-byte value capable of addressing at most 4 gigabytes. If your application supports HUGE files (greater than 4 gigabytes), you must use the ctSETHGH() and ctGETHGH() functions to set or get the high-order 4 bytes of the file offset. See also Record Offsets Under Huge File Support.

See also

ctSETHGH(), ctGETHGH(), ReReadVRecord(), ReadIsamData(), WriteData()

TOCIndex