注册 登录
编程论坛 VC++/MFC

关于CString的ReadString Find函数

shendade 发布于 2012-06-09 23:47, 2733 次点击
  while(file.ReadString(temp))
      {  //temp里面保存的是一行的值
                {
          sprintf(buffer,"信息文档为空,请稍后查询,谢谢使用!!!");//消息框提示!!
          MessageBox(buffer);
      }
            if(temp.Find(temp1)!=0)
                if(temp.Find(temp2)!=0)
                    if(temp.Find(temp3)!=0)
               {
                   iFiles.open("c:\\dk\\ShiXiSearch.txt",ios::trunc);//如果文件存在就清除其内容,不存在就新建      
                   iFiles<<"name\t"<<"num\t"<<"id\t"<<"pay\t"<<"outday\t"<<"BuZhu\t"<<"money"<<'\n'<<endl;
//                   iFiles<<name<<"\t"<<num<<"\t"<<id<<"\t"<<a[n+3]<<"\t"<<a[n+4]<<"\t"<<a[n+5]<<"\t"<<a[n+6]<<'\n'<<endl;
                   iFiles.close();
               }
      
      }
2 回复
#2
shendade2012-06-09 23:48
{
          sprintf(buffer,"信息文档为空,请稍后查询,谢谢使用!!!");//消息框提示!!
          MessageBox(buffer);
      }
是测试用的,,发现程序运行到while后就出错误了。。请问怎么解释
#3
shendade2012-06-09 23:50
意思是:把对话框读入的信息保存在三个CString temp1,2,3中,然后调用temp.Find(temp1)!=0  等比较有没有在temp中出现这三个串。。
都出现时,,实现文件的读写
1