I. Purpose hardware: CPU (Cyrix 200MHz), memory 16M, hard disk 4G Requirements: Double-click any FoxBase Database file icon in Windows 98 (each file data is recorded below 10,000), the program opens the database file And display the contents of the database.
Second, step foxbase database file format (refer to the file format of Mark Sadler and the corresponding C language source program file) Problem: The following is the DBF.h file part of the Mark Sadler: typedef unsigned char uchar;
Struct Field_Record / * this structure is filled in membrate * / {/ * with a futad. do not change. * / char name [11]; / * name of field in assez * / char type; / * type of field .. .char, numeric etc. * / char * field_data_address; / * offset of field in record * / #if defined (__ TINY__) || defined (__ SMALL__) || defined (__MEDIUM__) int space_holder; / * field_data_address must be 32 bits * / #Ndif ucharl, / * length of infrest * / uchar dec; / * decimals in field * / uchar reserved_bytes [14]; / * reserved by dbase * /};
struct DBF {char filename [MAXPATH]; / * dos filename * / FILE * file_ptr; / * c file pointer * / unsigned long int current_record; / * current record in memory * / enum / * status of file * / {not_open = 0, not_updated, updated} status; uchar num_fields; / * number of infields * /
/ * The Following 7 Variables Are Filled with a Fread, Do Not Change Order or size * / Uchar DBF_VERSION; / * VERSION Character * / Uchar Update_YR; / * DATE OF Last Update - Year (-1900) * / Uchar Update_mo; / * date of last update - month * / UCHAR update_day; / * date of last update - day * / unsigned long int records; / * number of records in dbf * / unsigned int header_length; / * length of header structure * / unsigned int record_length; / * length of a record * / / * * / struct FIELD_RECORD * fields_ptr; / * pointer to field array * / char * record_ptr; / * pointer to current record struct * /}; int d_addrec (struct DBF * d) INT D_BLANK (Struct DBF * D); INT D_CLOSE (Struct DBF * D); int D_cpystr (Struct DBF * S, Struct DBF * D); char D_GETFLD (Struct DBF * D, INT F, Char * BUFF); int D_GETREC (Struct DBF * D, Unsigned Long Int R); INT D_Open (Struct DBF * D); int D_putfld (Struct DBF * D, INT F, CHAR * BUFF); int D_putRec (Struct DBF * D, unsigned long int R );