为什么不仔细看看MSDN中的说明:
GetFile is a high-level routine that handles all of the overhead associated with reading a file from an FTP server and storing it locally. Applications that only retrieve file data, or that require close control over the file transfer, should use OpenFile and CInternetFile::Read instead. 

解决方案 »

  1.   

    我不明白这段语句有何作用,
    现在的现象就是GetFile(下载文件)后不能删除,报告:文件已经打开,
    而pufile(上传文件)成功.
    (好像,只要再服务器方打开文件的操作都关闭不了,也出现同样的问题)
    BSTR CFTPCtrl::GetFileString() 
    {
    CString strResult;
    // TODO: Add your dispatch handler code here
    CInternetFile *f=NULL;
    char *buf=new char[65536];
    unsigned int i;
    if(pFTPcon->SetCurrentDirectory(m_remoteDirectory)==TRUE)
    {
    if(f==NULL)
    {
    f=pFTPcon->OpenFile(m_remoteFile,GENERIC_READ,FTP_TRANSFER_TYPE_ASCII,1);

    i=f->Read(buf,65536);
    f->Close();
    }
    buf[i]='\0';
    strResult=buf;
    }
    else
    {
    strResult="";
    }
    delete buf;
    return strResult.AllocSysString();
    }谢谢,再给予赐教!
      

  2.   

    你用CFtpConnection::OpenFile和CInternetFile::Close还是一样问题么?你上面的程序也不行?MSDN中说如果对操作完的文件关闭就用这两个东东来做,对不起我没来得及试,我的VC又坏了:(
    如果Close有问题,你看一下执行Close后抛出的错误信息。
      

  3.   

    谢谢大家的答复!!
    上面的程序的却能够返回所有类容,但是就出现服务器单的该文件就一直打开,关闭FTP服务也不行,只有重启动.
    我想是否NT服务器设置有问题?
    谢谢,再给予赐教!
      

  4.   

    谢谢大家的答复!!
    我现在只好在ftp命令方面想办法了.