CFtpConnection* pConnect = NULL;
CInternetFile * pFile = NULL;
 try
 {
   pConnect = m_pSession->GetFtpConnection(szServer,szUsername,szPassword,nPort);    pFile = pConnect->OpenFile(szFile);
   if(pFile)
   { pFile->Seek(-128, CFile::end); //为什么会抛出一个异常? 而异常的ErrorMessage居然是"操作成功完成"!
   }
   }
   catch (CInternetException* pEx)
   {
#ifdef _DEBUG
      TCHAR sz[500];
      pEx->GetErrorMessage(sz, 500);
      TRACE("%s\n",sz);//ErrorMessage居然是"操作成功完成"!
#endif
      pEx->Delete();
   }
按理说, 操作成功完成了就不该抛出异常了呀, 我向上面这样使用CInternetFile::Seek有什么不对么?

解决方案 »

  1.   

    pFile->Seek(-128, CFile::end); //文件指针,向前移动,可以越界。
      

  2.   

    virtual LONG Seek( LONG lOffset, UINT nFrom );
    throw ( CInternetException );Return ValueThe new byte offset from the beginning of the file if the requested position is legal; otherwise, the value is undefined and a CInternetException object is thrown.&When a file is opened, the file pointer is at offset 0, the beginning of the file.前面wenxy1的说法有道理
    你好吗?现在在忙什么?情况如何? ^=^