希望对各位有帮助。
1-----------hansu.h内容
#include <stdio.h>
#include <string.h>
#include <io.h>
///// 串比较
bool cv_zfcbj(char *zfbja,char *zfbjb)
{int i=0,j=strlen(zfbja),k=strlen(zfbjb);
if(j!=k){return 0;}
while(i<j){
if(zfbja[i]!=zfbjb[i]){return 0;}
i++;
}
return 1;
}
2-----------主程序
#include "hansu.h"
main(){
char *shujuchuang,*shujuwj="config.ini",zleijia[20]={0},cv_tupianlujin[50]={0},cv_shujulujin[50]={0},cv_fuwuzhanmc[50]={0},cv_fuwuzhandh[50]={0},cv_gongshimingchen[50]={0},cv_gongshidizhi[50]={0},cv_gongshidh[50]={0};
int i=0,j=0,k,yy2;
yy2=open(shujuwj,2|0x0100|0x0800|0x8000,0x0100|0x0080);
long shujuchandu=filelength(yy2);
shujuchuang=new char [shujuchandu];
read(yy2,shujuchuang,shujuchandu);
close(yy2);
while(i<shujuchandu){
if(shujuchuang[i]=='\n'){i++;j=0;continue;}
if(shujuchuang[i]=='='){zleijia[j]=shujuchuang[i];i++;zleijia[j+1]=0x00;//不可不重重视问题!!printf("%c^1|%c*2|%c~3|%s |%d",zleijia[0],zleijia[1],zleijia[2],zleijia,cv_zfcbj(zleijia,"图片存放路径="));break;
if(shujuchuang[i]=='\n'){i++;j=0;continue;}
if(cv_zfcbj(zleijia,"图片存放路径=")){k=0;
while(shujuchuang[i]!='\n'){cv_tupianlujin[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"数据文件存放路径=")){k=0;
while(shujuchuang[i]!='\n'){cv_shujulujin[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"服务站名称=")){k=0;
while(shujuchuang[i]!='\n'){cv_fuwuzhanmc[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"站电话=")){k=0;
while(shujuchuang[i]!='\n'){cv_fuwuzhandh[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"软件公司=")){k=0;
while(shujuchuang[i]!='\n'){cv_gongshimingchen[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"公司地址=")){k=0;
while(shujuchuang[i]!='\n'){cv_gongshidizhi[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
if(cv_zfcbj(zleijia,"电话=")){k=0;
while(shujuchuang[i]!='\n'){cv_gongshidh[k]=shujuchuang[i];i++;k++;}
j=0;
goto uu;
}
j=0;i++;continue;
//printf("tttt==%s==ttttttttttttt%d|%d",zleijia,i,shujuchandu);
//break;
}
zleijia[j]=shujuchuang[i];
j++;uu:
i++;
}
printf("\n%s",cv_tupianlujin);printf("\n%s",cv_shujulujin);printf("\n%s",cv_fuwuzhanmc);printf("\n%s",cv_fuwuzhandh);printf("\n%s",cv_gongshimingchen);printf("\n%s",cv_gongshidizhi);printf("\n%s",cv_gongshidh);
}
3----配置内容
[系统设置]
图片存放路径=D:\BCB临时\liudong\DATA
数据文件存放路径=D:\BCB临时\liudong\DATA
服务站名称=马尾区计划生育服务站
站电话=5588855
软件公司=厦门德康医疗设备有限公司
公司地址=仙岳路692号1801室
电话=05925588856
[照片]
像源=1
亮度=50
对比度=50
色度=50
饱和度=50
VCL=1
设备0=10Moons SDK-2000 Video Capture
设备1=Fametech USB PC CAMERA
设备号=0
[B超]
像源=0
亮度=50
对比度=50
色度=50
饱和度=50
强制使用=2
[指纹]
delay=5000
level=5
portNum=7
portType=0
bright=0
contrast=0
------下载地址:http://down1.tomore.com/source/20061217/200612171031177156.rar
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!