Dec 062017
 
A collection of C database routines that access dBase DBF files.
File CDBF.ZIP from The Programmer’s Corner in
Category C Source Code
A collection of C database routines that access dBase DBF files.
File Name File Size Zip Size Zip Type
DBASE.C 14005 2579 deflated
DBASE.DOC 7547 1257 deflated
DBASE.H 2540 833 deflated
DBASE.OBJ 2850 1719 deflated
RDDBASE.BAK 2564 905 deflated
RDDBASE.C 2555 899 deflated
RDDBASE.EXE 11398 6781 deflated

Download File CDBF.ZIP Here

Contents of the DBASE.DOC file


/* dbase.doc 10/20/87


Documentation for 'C' routines to access DBase III .dbf files


Soft-Sense
daniel lullo
1682 Valley Rd.
Millington, N.J. 07946

*/



Function : db_open(filnam, mode)
char *filnam; /* filename */
unsigned mode; /* access mode (ref dopen) */


Description : Open a DBase III file, allocate file information block,
header block, field descriptor block(s), and field buffers.


Returns : Pointer to the file information block if successful, otherwise
Null pointer.


Cautions : Call prior to using any other interface routines.


/*****************************************************************************/


Function : db_close(file)
DB_FILE *file; /* fib pointer */


Description : Close a DBase III file, free any buffers that were allocated,
and optionally update header.


Returns : None.


Cautions : If file->up_mode


/*****************************************************************************/


Function : db_seek(filnam, recnum)
DB_FILE *file; /* fib pointer */
unsigned long recnum; /* record number requested */


Description : Position the file character pointer to the requested record
in the file.


Returns : Integer value.
1 = successful.
0 = error in seek.


Cautions : Reference errno or _OSERR for more error information.


/*****************************************************************************/


Function : db_read(file, buffer, recnum, explode)
DB_FILE *file; /* fib pointer */
char buffer; /* I/O buffer */
unsigned long recnum; /* record number to read */
int explode; /* explode option */


Description : Read a specific record, optionally explode record into
individual field buffers. If explode option is used
file->del_byte will contain the record deletion status
byte.


Returns : Integer value.
1 = successful.
0 = record returned was marked for delete
file->del_byte contains the delete character.
-1 = error in seek.
-2 = number of bytes read was not correct record length.


Cautions : Reference errno or _OSERR for more error information.
File must have been opened for read access.


/*****************************************************************************/


Function : db_getnext(file, buffer, explode)
DB_FILE *file; /* fib pointer */
char *buffer; /* I/O buffer */
int explode; /* explode option */


Description : Read the next sequential record, optionally explode record into
individual field buffers. If explode option is used
file->del_byte will contain the record deletion status
byte.


Returns : Integer value.
1 = successful.
0 = record returned was marked for delete
file->del_byte contains the delete character.
-1 = error in seek.
-2 = number of bytes read was not correct record length.


Cautions : Reference errno or _OSERR for more error information.
File must have been opened for read access.


/*****************************************************************************/


Function : db_write(file, buffer, recnum, implode)
DB_FILE *file; /* fib pointer */
char *buffer; /* I/O buffer */
unsigned long recnum; /* record number to read */
int implode; /* implode option */


Description : Write a specific record, optionally implode record from
individual field buffers, or use data already in buffer.
If implode option is used, file->del_byte is used as the
record deletion status byte, this should be set to
for valid record or for marked for delete.
Header record is written if file->up_mode = 0, otherwise
header is written only upon closing the file.


Returns : Integer value.
1 = successful.
-1 = error in seek.
-2 = number of bytes read was not correct record length.
-3 = error updating file header.


Cautions : Reference errno or _OSERR for more error information.
File must have been opened for write access.


/*****************************************************************************/


Function : db_append(file, buffer, implode)
DB_FILE *file; /* fib pointer */
char *buffer; /* I/O buffer */
int implode; /* implode option */


Description : Append a record at end of file, optionally implode record from
individual field buffers, or use data already in buffer.
If implode option is used, file->del_byte is used as the
record deletion status byte, this should be set to
for valid record or for marked for delete.
Header record is written if file->up_mode = 0, otherwise
header is written only upon closing the file.


Returns : Integer value.
1 = successful.
-1 = error in seek.
-2 = number of bytes read was not correct record length.
-3 = error updating file header.


Cautions : Reference errno or _OSERR for more error information.
File must have been opened for write access.


/*****************************************************************************/


Function : db_explode(file, buffer)
DB_FILE *file; /* fib pointer */
char *buffer; /* I/O buffer */


Description : Explode data from the I/O record buffer into the corresponding
individual field buffers. These field buffers are null
terminated so they may be easier for the application to
work with.


Returns : None.


Cautions : file->del_byte will be set according to the record
deletion status.


/*****************************************************************************/


Function : db_implode(file, buffer)
DB_FILE *file; /* fib pointer */
char *buffer; /* I/O buffer */


Description : Implode data from the individual field buffers into the
I/O record buffer. The record deletion status byte is
set from file->del_byte.


Returns : None.


Cautions : file->del_byte should be set according to the record
deletion status desired.


/*****************************************************************************/


 December 6, 2017  Add comments

Leave a Reply