解决方案 »

  1.   

    记事本(就是你说的TXT)支持ANSI、Unicode、Unicode big endian、UTF-8四种编码格式。可以保存记事本的编码格式和你的程序一致,具体使用方式:记事本文档在保存和另存为时,出现的对话框的右下角中有编码的选择框,里面列出了所有可用的编码格式。
      

  2.   

    显示的文字可能一样,但内部编码可能不同。有些时侯同一个复制下来的文本,粘到Note PAD 记事本应用程序中显示就没有问题,而粘到Utral Editor 里就是乱码,这里就是出现了编码的问题。看看你的程序在这方面是否存在此问题,仅供参考。
      

  3.   

    ReadString(q_szLine)Res
    Reads text data into a buffer, up to a limit of nMax–1 characters, from the file associated with the CStdioFile object. Reading is stopped by the first newline character. If, in that case, fewer than nMax–1 characters have been read, a newline character is stored in the buffer. A null character (‘\0’) is appended in either case.
    is also available for text-mode input, but it does not terminate on a carriage return–linefeed pair.就是说 ReadString 读入 回车换行,
    而 say_mine 来自 edit 不带 回车换行 。
      

  4.   


    ReadString 读入的长度比say_mine多一位,去掉一位和say_mine比较还是不匹配,难道 ReadString 读入的多 回车换行 ,而say_mine多个\0 ?
      

  5.   

    晕倒,逻辑错误了.
    for(vector<CString>::size_type i=0;i!=q_data.size();i++)
    {                   //CString findstr;
                       //findstr.Format("%s\r\n",say_mine);
    if(say_mine==q_data[i])   //明明有相同的,就是不为真
    {                  TRACE("%s",q_data[i]);   //没结果   say_doll=q_data[i+1];                      UpdateData(false);}
    else
    {
            say_doll=L"找不到?";    //say_doll是要显示的value变量
          
                         // say_doll=q_data[5];     //能正常得到结果
           
                            UpdateData(false);}能找到,for循环把 else部分覆盖了找到的部分,所以显示的是 找不到? 无语.
      

  6.   

    ReadString 读入的长度比say_mine多一,就是 LF (0x0A),
    把这个清除 就可以了
     q_temp=Left ( q_szLine.GetLength()-1);