16,551
社区成员
发帖
与我相关
我的任务
分享
#include<afxinet.h>
#include<afxwin.h>
#include<iostream>
using namespace std;
void main()
{
CInternetSession *m_pInetssion;
CFtpConnection *m_pFtpConn;
char *m_pIP = "192.92.200.32";
char *m_pUser = "trs";
char *m_pPassWd = "trs";
int m_nPort = 21;
m_pInetssion = new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);
try
{
m_pFtpConn = m_pInetssion->GetFtpConnection(m_pIP,m_pUser,m_pPassWd,m_nPort);
if(m_pFtpConn != NULL)
cout<<"连接FTP成功"<<endl;
}
catch(CInternetException *pE)
{
cout<<"连接不成功"<<endl;
m_pFtpConn=NULL;
return;
}
}