Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

WriteData

Write fixed-length data record.

Short Name

WRTREC()

Type

Low-Level data file function

Declaration

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

WriteData() writes the fixed-length data record from the buffer area pointed to by recptr into record position recbyt for data file datno.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful write.

29

ZREC_ERR

Attempt to write 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 write.

37

WRITE_ERR

Operating system could not execute write. Most likely cause is a full disk or directory.

57

DADV_ERR

Proper lock not held when CHKLOK specified.

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

Example

FILNO datno;

TEXT recptr[1024];


if (WriteData(datno, NewData(datno), recptr))

printf("\nCould not write record. Error #%d",uerr_cod);

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

ReadData(), NewData(), WriteVData()

TOCIndex