CString t_strFileName=m_FileList.GetItemText(m_pos,0);
CFileDialog fileDialog(FALSE,"*.*",t_strFileName,NULL,"文件(*.*)|*.*;||");
if (fileDialog.DoModal() == IDOK) 
{
szLocalFileName=fileDialog.GetFileName();//将文件名存入成员变量
g_localpath=szLocalFileName;
g_remotepath=m_DirPath+"\\"+t_strFileName;
就到此处~:
         调试到此m_DirPath="wav"
                t_strFileName="abx.txt";
               可气人的是g_remotepath竟为"\abx.txt"?
为什么》?
    

解决方案 »

  1.   

    換成:g_remotepath=g_remotepath + m_DirPath + "\\" + t_strFileName試試!
      

  2.   

    g_remotepath.format("%s\\%s",m_dirpath,t_strfilename);
      

  3.   

    CString strA = "C:";
    CString strB = "tt.txt";
    CString strC;
    strC = strA +"\\"+strB;我用上面这段代码试了,没有问题啊,你在仔细检查一下。
      

  4.   

    g_remotepath.format("%s\\%s",m_dirpath,t_strfilename);
    ===============
    这个方法不错
      

  5.   

    如果
    m_DirPath = "wav";
    t_strFileName="abx.txt";
    g_remotepath = m_DirPath + "\\" + t_strFileName;代码应该是没有问题的
      

  6.   

    实在不行就用标准C函数来做:
    char szPathFile[MAX_PATH] ;
    memset(szPathFile, 0x0 , MAX_PATH);
    memcpy(szPathFile , m_DirPath.GetBuffer(0), m_DirPath.GetLength());
    strcat(szPathFile ,"\\");
    strcat(szPathFile , t_strFileName.GetBuffer(0), t_strFileName.GetLength());
    ASSERT(szPathFile);