Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : D3.ZIP
Filename : DB3.DOC

 
Output of file : DB3.DOC contained in archive : D3.ZIP

I know!, this is a poor excuse for documentation. Please bear with me
while I am writing a comprehensive user guide. Meanwhile, the source
code to the demo program, and the header file should provide enough
info to get you by.

If you have sent the suggested $15.00 regristation fee, I'll place your
name on a list of kind souls to receive the latest issue of the docs,
as well as info on any further enhancements or developments.


/*****************************************************************************
* Functions to read dBASE III+ files *
* *
* dopen - open database, read header, fields, set up 'area' struct. *
* dclose - close open database file *
* dprthdr - print database header and data dictionary *
* dgetrec - read a record from the open database *
* dputrec - write a record to the open database *
* dprtrec - print a single record gotten by the dgetrec call *
* dgetfld - retreive a database record field *
* dputfld - put user data into field *
* dprtfld - print a single field *
* dappend - append a record to the open database *
* dskip - skip to next sequential record in data file *
* *
*****************************************************************************/


/*****************************************************************************
* dappend - append a record to the open database *
*****************************************************************************/
int
dappend(area)
DBAREA *area;


/*****************************************************************************
* dclose - close open database file *
*****************************************************************************/
int
dclose(area)
DBAREA *area;


/*****************************************************************************
* dgetfld - retreive a database record field *
*****************************************************************************/
DBFIELD *
dgetfld(area, field)
DBAREA *area;
char *field;


/*****************************************************************************
* dgetrec - read a record from the open database *
*****************************************************************************/
int
dgetrec(area, recno)
DBAREA *area;
unsigned long recno;


/*****************************************************************************
* dopen - open database, read header, fields, set up 'area' struct. *
*****************************************************************************/
DBAREA *
dopen(datafile, mode)
char *datafile;
int mode;


/*****************************************************************************
* dperror - print error message and return fatal error flag *
*****************************************************************************/
struct errors {
char *string;
int fatal;
} errors[] = {
"no error condition", 0, /* 0 DB3_NOERROR */
"file open error", 1, /* 1 DB3_OPENERR */
"file not found", 1, /* 2 DB3_NOTFOUND */
"no prior record", 0, /* 3 DB3_NOPRIOR */
"end of file", 0, /* 4 DB3_ENDFILE */
"beginning of file", 0, /* 5 DB3_BEGFILE */
"bad record number", 0, /* 6 DB3_NORECORD */
"not enough memory", 1, /* 7 DB3_NOMEMORY */
"bad index file", 1, /* 8 DB3_BADINDEX */
"file I/O error", 1, /* 9 DB3_IOERROR */
"no file exists", 1, /* 10 DB3_NOFILE */
"incorrect version", 1, /* 11 DB3_VERSION */
"data size error", 0, /* 12 DB3_FLDSIZE */
"field format error", 0, /* 13 DB3_FLDFORM */
"header format error", 0 /* 14 DB3_HDRFORM */
};
int
dperror(errnum)
int errnum;


/*****************************************************************************
* dprtfld - print a single field *
*****************************************************************************/
void
dprtfld(field)
DBFIELD *field;


/*****************************************************************************
* dprthdr - print database header and data dictionary *
*****************************************************************************/
void
dprthdr(area, type)
DBAREA *area;
int type;


/*****************************************************************************
* dprtrec - print a single record gotten by the dgetrec call *
*****************************************************************************/
void
dprtrec(area)
DBAREA *area;


/*****************************************************************************
* dputfld - put user data into field *
*****************************************************************************/
int
dputfld(area, fname, data)
DBAREA *area; /* which database */
char *fname; /* which field */
char *data; /* data to store */


/*****************************************************************************
* dputrec - write a record to the open database *
*****************************************************************************/
int
dputrec(area, recno)
DBAREA *area;
unsigned long recno;


/*****************************************************************************
* dskip - read next or previous record from the open database *
*****************************************************************************/
/********************************************
* dskip - read records into area structure *
* NOTE! - This is sequential access only! *
* NO INDEX is used! *
********************************************/
int
dskip(area, skipdir)
DBAREA *area; /* current active area */
int skipdir; /* +n to go forward -n to go backward */