FFDbfOpen - FFDbfGetRecord - FFDbfClose
DBF read routines

Prototype

Put the following prototypes in the prototypes section of the application program header file:

int    ( __stdcall *pfnFFDbfOpen )( char* );
char*  ( __stdcall *pfnFFDbfGetRecord)( int );
void   ( __stdcall *pfnFFDbfClose )( void );

Purpose

Read records in DBF files without using the Borland Database Engine.

Description and use

Use these 3 routines to open, read a record, and close a DBF file. All without using the BDE.

BDE is great, but using it with DBFs is like shooting a fly using a war weapon.

You must know the record number to read, and for this reason you might want to use this set of DBF read routines in conjunction with the set of NTX read routines.

You also must know in advance the structure of the record. In fact FFDbfGetRecord doesn't care the structure, it only reads a whole record, included the leading byte (being 0x20 a normal record, and 0x2A a deleted record).

See the examples to see how to use it all. You might say that this set of routines is very low level, but C++ itself is low level, too...

Important note: if the DBF exists but FFDbfOpen fails then wait a second and retry (this could happen if the DBF is locked by some other user).

Specification

Please refer to the Clipper DBF file specification.

Parameters
  • FFDbfOpen:
    • pointer to the complete DBF path and filename to open
  • FFDbfGetRecord:
    • the number of the record to read
  • FFDbfClose:
    • (no parameters)

Return value

  • FFDbfOpen:
    • 0: open failed
    • >0: open successful, the total number of records is returned
  • FFDbfGetRecord:
    • pointer to the record in ASCIIZ
  • FFDbfClose:
    • (no return value)

Application examples

See also
  • FFNtx routines: a set of routines to read NTX files and search keys in the b-tree

Notes