我做一个控制台程序,连接ftp,编译连接都正确,但是运行 m_pInetssion = new CInternetSession(AfxGetAppName(),1,PRE_CONFIG_INTERNET_ACCESS);的时候直接崩溃了,各位帮忙看一下原因,代码如下:#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; }
}
#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; }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货