资源描述:
《c语言课程设计6典型小程序.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、典型小程序1.读取DBF文件(READDBF.C)......................................................................................12.读取文件中整数并排序(filetest.c)............................................................................................23.鼠标应用(mousetes.c).......
2、.........................................................................................................34.画图(painttes.c)..........................................................................................................................55.文件系统中目录
3、内容显示(dirtest.c)........................................................................................96.链表插入操作(list.c)..................................................................................................................91.读取dbf文件(readdbf.c
4、)/*读取dbf文件指定记录范围的详细*/#includeintrf,k,reclen,addr,*p1;longbrec,erec,i,j,recnum,*p2;unsignedcharbuf[4096],pbuf[81];FILE*fp;main(intargc,char*argv[]){if(argc==1){printf("Usage:");exit(0);}fp=fopen(argv[1],"rb");if(fp==NULL){printf("%scannotopen
5、",argv[1]);exit(0);}fread(buf,1,32,fp);p1=(int*)buf;p2=(long*)buf;p2++;recnum=*p2;p1+=4;addr=*p1;p1++;reclen=*p1;if(argc==2){rf=0;brec=1;erec=recnum;}if(argc==3){rf=atoi(argv[2]);brec=1;erec=recnum;}if(argc==4){rf=atoi(argv[2]);brec=atoi(argv[3]);erec=re
6、cnum;}1if(argc==5){rf=atoi(argv[2]);brec=atoi(argv[3]);erec=atoi(argv[4]);}fseek(fp,(long)addr-32,1);for(i=1;i