www.pudn.com > inet_stock.zip > SV_DBF.H



#define SUCCESS        0
#define FAIL           -1

#define VALID          1
#define INVALID        0

#define ENDOFFILE      0x1a
#define CH_SPACE       0x20

#define OPEN_RETR     20
#define OPEN_INTERVAL 500

#define ENDOFFILE     0x1a
#define SUCCEED         0
#define OPEN_ERROR     -1
#define ALLOC_ERROR    -3
#define DBF_ERR        -2
#define READ_ERROR     -4
#define WRITE_ERROR    -5
#define LOCK_FAILED    -6
#define DBF_DESTROYED  -7
#define INIT_DBF_ERROR -8

typedef struct DBFINFO {
			  unsigned char id;              /* the ID.for a FoxBase+ DBF File */
			  char          date[3];         /* year,month and date            */
			  char          recnum[4];       /* total number of records        */
			  char          hlen[2];         /* length of DBF head             */
			  char          rlen[2];         /* length of each record          */
			  char          null[20];        /* null char in the info. unit    */

			  }             DbfStruct;


typedef struct FLDINFO {
		  char          name[10];        /* fld name                      */
		  char          null1;           /* fixed to 0x00                  */
		  char          type;            /* field type                     */
		  char          offset[2];       /* field offset in a record       */
		  char          null2[2];        /* null chars                     */
		  char          wid;             /* field length                   */
		  char          pnt;             /* point number length            */
		  char          null3[14];       /* used by system                 */
		  }             FieldStruct;

HFILE OpenDbfBase(char *file_name,int amode);
int CloseDbf(int hd);
int  CheckDbf(int hd,DbfStruct *d_info,FieldStruct *f_info,short f_num);
int  InitBase(int hd, DbfStruct *BaseInfo,FieldStruct **FldInfo,short *FieldNum);
int  FldToString(char *rbuff,FieldStruct *finfo,char *fstr);
int  StringToFld(char *fbuff,FieldStruct finfo,char *fstr);

int AppendRecord(int hDbf, DbfStruct *lpDbfInfo, char *lpDbfRecBuf);
int ReadRecord(int hd,int no,short hlen,short rlen,char *rbuff);