TCHAR  *str1[10];
CFile theFile;
theFile.Open("c:\\a3.txt", CFile::modeRead);
UINT nBytesRead = theFile.Read(str1, 10 );
 m_str=(char *)str1;
 m_edit.SetWindowText(m_str);

解决方案 »

  1.   

    char str1[10];
    CFile theFile;
    theFile.Open("c:\\a3.txt", CFile::modeRead);
    UINT nBytesRead = theFile.Read(str1, 10 );
     CString m_str;
    m_str.Format("%s",str1);
     m_edit.SetWindowText(m_str);
      

  2.   

    char str1[11];
    CFile theFile;
    theFile.Open("c:\\a3.txt", CFile::modeRead);
    UINT nBytesRead = theFile.Read(str1, 10 );
    strl[10]=0;
     CString m_str;
    m_str.Format("%s",str1);
     m_edit.SetWindowText(m_str);
      

  3.   

    BOOL m_begin=TRUE;
    if(m_File.Open(m_sFilepath,CFile::modeRead))
    {
    char buf[1000];
    char buf1[1000];
    int nFileSize=m_File.GetLength();
    while(nFileSize>0)
    {
    memset(buf,0,1000);
    int nSize=sizeof(buf);
    if(nSize>nFileSize)
    nSize=nFileSize;
    m_File.Read(&buf,nSize);
    m_File.Seek(-nSize,CFile::current);
    int len=0;
    BOOL a=TRUE;
    CString bb;
    while(a==TRUE)
    {
    if((buf[len]==0x0d)&&(buf[len+1]==0x0a))
    {
    len++;
    a=FALSE;
    }
    len++;
    }
    memset(buf1,0,1000);
    strncat(buf1,buf,len);
    //bb=buf1.Mid(0,4);
    m_File.Seek(len,CFile::current);
    m_Messages.AddString(buf1);
    if(m_begin==TRUE)
    {
    m_Messages.SelectString(-1,buf1);
    m_begin=FALSE;
    }
    nFileSize-=len;
    }
    }
    m_File.Close();