一个读取INI文件的程序为何MODEL的值会变呢?烦请各位大侠们帮助下!
char *IMODEL;char *TAG;
char *SER;
char *DCODE;
char *BBO;
char *tmp;
char *MODEL;
char *MBTOOL;
int resout;
struct palettetype palette; /* Used to read palette info */
int LEN;
int main()
{
int MCODEYN=1;
IMODEL="NOINPUT";
MODEL="TTN";
tmp="NOINPUT";
TAG="1111111";
SER="11111111-1111111";
DCODE="111111111";
BBO="11111111111";
Initialize(); /* Set system into Graphics mode */
WelcomePM();
CreatPM();
Select();
while (*IMODEL==*tmp)
{
StatusLine("--- Please input the MODEL ! EX. TTN-1534 ---",15); /*底部信息提示函数,StatusLine("提示信息",颜色号) */
IMODEL=Input(10,200,12,"Please Input The Model:",12); /*屏幕输入函数,Input(x轴,y轴,颜色号,"提示信息",输入的长度); */
resout=GetMODEL(IMODEL);
if (*IMODEL==*tmp)
{
StatusLine("--- You have no input anything ! After press anykey to reinput ! ---",12);
getch();
}
else if (resout==0)
{
StatusLine("--- The input's Model is inconsistent with the choice Model ! Please choose! ---",12);
IMODEL="NOINPUT";
getch();
QP();
CreatPM();
Select();
}
}
strcpy(MODEL,IMODEL);
printf("IMODEL=%s\n",IMODEL);
printf("MODEL=%s\n",MODEL);
strcpy(IMODEL,"NOINPUT");
while (*IMODEL==*tmp)
{
StatusLine("--- Please input the TAG ! EX. C2002JS ---",15);
IMODEL=Input(10,212,12,"Please Input The TAG:",7);
if (*IMODEL==*tmp)
{
StatusLine("--- You have no input anything ! After press anykey to reinput ! ---",12);
getch();
}
if (strlen(IMODEL)<7 && IMODEL!=*tmp)
{
StatusLine("--- The length of TAG is less than 7 ! After press anykey to reinput ! ---",12);
IMODEL="NOINPUT";
getch();
setfillstyle(1,0);
bar(10,210,222,224);
}
}
strcpy(TAG,IMODEL);
printf("\n");
printf("MODEL=%s\n",MODEL);
printf("IMODEL=%s\n",IMODEL);
printf("TAG=%s\n",TAG);
strcpy(IMODEL,"NOINPUT");
while (*IMODEL==*tmp)
{
StatusLine("--- Please input the SER ! EX. 12345678-1234567 ---",15);
IMODEL=Input(10,224,12,"Please Input The SER:",16);
if (*IMODEL==*tmp)
{
StatusLine("--- You have no input anything ! After press anykey to reinput ! ---",12);
getch();
}
else if (strlen(IMODEL)<16 && IMODEL!=*tmp)
{
StatusLine("--- The length of SER is less than 16 ! After press anykey to reinput ! ---",12);
IMODEL="NOINPUT";
getch();
setfillstyle(1,0);
bar(10,222,222,234);
}
}
strcpy(SER,IMODEL);
strcpy(IMODEL,"NOINPUT");
printf("MODEL=%s\n",MODEL);
printf("TAG=%s\n",TAG);
printf("SER=%s\n",SER);
BBO=GetInitKey("mbtool.ini","BBO",MODEL); /*ini文件读取函数 GetInitKey("文件名","字段名","KEY名") */
DCODE=GetInitKey("mbtool.ini","DCODE",MODEL);
printf("BLNO=%s\n",BLNO);
printf("DCODE=%s\n",DCODE);
getch();
/*SayGoodbye(); */
}
MBTOOL.INI内容
[ROMINFO5]
TTN-111C
TTN-119CP
[BB0]
TTN-112C=KODO-121212
TTN-119CP=KODO-111189
VGN-111C=KODO-123123
[DCODE]
TTN-119CP=DE1234D00
程序见上:
怪事是输入MODEL时是正确的,但输入TAG时MODEL就变了,具体见照片吧,请各位大侠们帮忙分析下哪出错了,谢谢了!
[ 本帖最后由 rangelee 于 2009-9-26 15:14 编辑 ]