求救啊!关于用vc建立ftp连接的问题,用CInternetSession类
nemo 2003-03-06 02:45:43 我建立一个建立ftp连接并下载文件的类,但每当执行程序时执行到Int_Session=new CInternetSession(AfxGetAppName(),1,INTERNET_OPEN_TYPE_PRECONFIG);时总会发生debug assertion failed!的错误,百思不得其界,希望大家帮忙
该类声明如下:
ftp(LPCTSTR Ser)
{
Server_Name=Ser;
Int_Session=new CInternetSession(AfxGetAppName(),1,INTERNET_OPEN_TYPE_PRECONFIG);
try
{
Ftp_Connection =Int_Session->GetFtpConnection(Server_Name,"anonymous","FTP@tengtu.com",21,FALSE );
}
catch(CInternetException *pEx)
{
TCHAR szError[1024];
if(pEx->GetErrorMessage(szError,1024))
AfxMessageBox(szError);
else
AfxMessageBox("There was an exception");
pEx->Delete();
Ftp_Connection=NULL;
exit(1);
}
cout<<"2"<<endl;
}
void ftp_openfile(char *file,int Access_Sign);
void ftp_read(char *file,CInternetFile *Intnet_File);
void ftp_write(char *file,CInternetFile *Intnet_File);
void ftp_close(void);
};