巨经典的DBF文件C++操作程序Word文档下载推荐.docx

上传人:b****3 文档编号:6365601 上传时间:2023-05-06 格式:DOCX 页数:70 大小:36.81KB
下载 相关 举报
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第1页
第1页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第2页
第2页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第3页
第3页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第4页
第4页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第5页
第5页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第6页
第6页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第7页
第7页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第8页
第8页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第9页
第9页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第10页
第10页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第11页
第11页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第12页
第12页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第13页
第13页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第14页
第14页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第15页
第15页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第16页
第16页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第17页
第17页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第18页
第18页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第19页
第19页 / 共70页
巨经典的DBF文件C++操作程序Word文档下载推荐.docx_第20页
第20页 / 共70页
亲,该文档总共70页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

巨经典的DBF文件C++操作程序Word文档下载推荐.docx

《巨经典的DBF文件C++操作程序Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《巨经典的DBF文件C++操作程序Word文档下载推荐.docx(70页珍藏版)》请在冰点文库上搜索。

巨经典的DBF文件C++操作程序Word文档下载推荐.docx

#include"

stdafx.h"

#ifdefDEBUG

#definedebugmAfxMessageBox

#definenewDEBUG_NEW

#endif

staticINT2ccc(CHAR*,INT2,INT2);

INT2ccc(CHAR*ptsr,INT2len,INT2bit)

{

 

CHARtemp1[30],temp11[30],i1;

CHARtemp2[30],temp22[30],i2;

INT2 

tempi,i;

CHAR*ps,*ps1;

for(ps1=ptsr;

(*ps1=='

'

)&

&

(*ps1!

='

\x0'

);

ps1++);

ps=strchr(ps1,'

.'

if(ps==NULL){ 

//NOTHAVE'

strcpy(temp1,ps1);

temp2[0]='

;

}else{

*ps='

ps++;

strcpy(temp2,ps);

}

i1=len-(bit?

(bit+1):

0);

if((int)strlen(temp1)>

(int)i1){

strncpy(temp11,temp1,i1);

temp11[i1]='

tempi=i1-strlen(temp1);

for(i=0;

i<

tempi;

i++)temp11='

strcpy(temp11+tempi,temp1);

//------------------------------------------

if(bit>

0){

if((int)strlen(temp2)>

(int)bit){

strncpy(temp22,temp2,bit);

temp22[bit]='

i2=strlen(temp2);

tempi=bit-strlen(temp2);

strcpy(temp22,temp2);

i++)(temp22+i2)='

0'

strcpy(ptsr,temp11);

if(bit!

=0){

strcat(ptsr,"

."

strcat(ptsr,temp22);

return0;

}

INT2IDX_BLOCK:

skip()

if(curp>

=(INT2)items-1){

return-2;

curp++;

//double

find(CHAR*key)

INT2compi=keylen;

CHAR*p=buff+12;

INT2RetCode,i;

if((int)strlen(key)<

(int)keylen)

compi=strlen(key);

for(i=0,p=buff+12;

items;

i++,p+=keylen+4){

RetCode=strncmp(key,p,compi);

if(RetCode==0) 

//Foundedthiskey

if(flag>

=2){ 

//.and.thisisaleaforleaf&

rootnode

curp=i;

//Founded,OKreturntomaster

}else{ 

//.and.thisisaframeorrootnode

return-10;

//ThisisaROOT,MaybeingavenBLOCK

if(RetCode<

0){ 

//ifthekey<

curentkeyinidxfile

if(flag<

2){ 

//andthisisFRAMEorROOTnode

//inFRAMEorROOTnodekeyisMAXKEYingivennode

//ThisisaROOT,MaybeingavenBLOCK

return-3;

//MaybeinNextBlock

IDX:

IDX()

Installed=0;

//fp=NULL;

handle=-1;

rootpos=blocks=0l;

key_len=0;

return;

~IDX()

if(this->

handle!

=-1){

close(handle);

//openfunctionopentheidxfile

INT2IDX:

pen(CHAR*filename)

CHARbuff[30];

//fp=_fsopen(filename,"

rb"

SH_DENYNONE);

//changebyliaojint1999.3.22

handle=sopen(filename,_O_RDONLY|_O_BINARY,_SH_DENYNO,_S_IREAD);

/*

handle=sopen(filename,O_RDWR|O_BINARY|O_DENYNONE,

SH_DENYNONE,S_IREAD|S_I_write);

*/

//if(fp==NULL)return-1;

if(handle==-1)return-1;

if(_lseek(handle,0,SEEK_SET)!

=0)return-1;

if(read(handle,buff,30)!

=30)return-1;

rootpos=*(UINT4*)buff;

blocks=*(UINT4*)(buff+

key_len=*(INT2*)(buff+12);

block.SetKeyLen(key_len);

block.ReadBlock(this->

handle,rootpos);

while(block.GetFlag()<

2){

handle,block.GetResult());

GoHome();

rev()

UINT4PrevBlock;

if(block.Prev()!

PrevBlock=block.GetPrev();

if(PrevBlock==0xffffffffl){

return-1;

handle,(INT4)PrevBlock);

block.End();

Next()

UINT4NextBlock;

if(block.Next()!

=0){ 

//Isalreadyinthelastnodeinthisblock

NextBlock=block.GetNext();

if(NextBlock==0xffffffffl){

handle,(INT4)NextBlock);

block.Home();

Find(CHAR*key)

INT2RetCode;

for(;

RetCode=block.find(key);

switch(RetCode){

case0:

return0;

case-1:

return-1;

case-2:

if(block.GetPrev()==(UINT4)0xffffffffl){

}else{

block.ReadBlock(this->

handle,block.GetPrev());

break;

case-3:

if(block.GetNext()==(UINT4)0xffffffffl){

}else{

handle,block.GetNext());

break;

case-10:

default:

//-------------------------------------------------

//FatalError:

returncodeisnotallow

// 

inclassIDX_BLOCK:

find(CHAR*);

Skip()

returnNext();

INT2 

GoHome()

while(block.GetPrev()!

=(UINT4)0xffffffffl){

};

GoEnd()

while(block.GetNext()!

UINT4IDX_BLOCK:

GetResult()

CHARtf[5];

CHAR*p=buff+12+curp*(keylen+4);

p+=keylen;

tf[3]=p[0];

tf[2]=p[1];

tf[1]=p[2];

tf[0]=p[3];

return*(UINT4*)tf;

//INT2IDX_BLOCK:

ReadBlock(FILE*fp,UINT4pos)

ReadBlock(INT2handle,UINT4pos)

//fseek(fp,pos,SEEK_SET);

_lseek(handle,pos,SEEK_SET);

//fread(buff,512l,1,fp);

read(handle,buff,512);

flag=buff[0];

count=buff[1];

items=buff[2];

prev=*(UINT4*)(buff+4);

next=*(UINT4*)(buff+

curp=0;

//------------------NextisDBF----------------------

DBF:

BF()

First=NULL;

pIDX=NULL;

buff=NULL;

//---------------------------------

SwapBuffer=NULL;

MaxRecNum=0;

CurRecNum=0;

//--------------------------------

current_recno=record_no=0l;

record_len=0;

Name[0]='

changeflag=0;

dbferrno=0;

fieldvalue=NULL;

~DBF()

if(First!

=NULL){

deleteFirst;

if(SwapBuffer!

=NULL)deleteSwapBuffer;

if(pIDX!

if(handle!

=-1){//this

:

close(handle);

if(buff!

deletebuff;

if(fieldvalue!

deletefieldvalue;

return;

INT2DBF:

Clear()

memset(buff,'

record_len);

return

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 卡通动漫

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2