如何判断一个文本文件中是否包含某一字符串

解决方案 »

  1.   

    CFile file("使用说明.txt",CFile::modeRead);
    CString strTemp,strYourFind;
    int iLength=file.GetLenght;
    file.Read(strTemp,iLenth);
    if(strTemp.Find(strYourFind,0)!=-1)
    {
    //找到了。
    }
      

  2.   

    用楼上老兄方式可以,最好用ReadHuge,否则可能读不全:)
      

  3.   

    CFile file("aaa.txt",CFile::modeRead);
    CString strTemp;
    int nLength=file.GetLength();
    strTemp.GetBuffer(nLength);
    file.Read(strTemp,nLength);
    strTemp.ReleaseBuffer();
    if(strTemp.Find(strYourFind,0)!=-1)
    {
    //ok
    }