菜鸟问:网络文件传输的问题?急!急!急!.........不好意思!我只有这点分
刚开始学网络编程,应用向导生成一个程序框架,在CHqtranView视图类头文件中定义两个成员变量:CInternetSession* m_pInternetSession;
CFtpConnection* m_pFtpConnection;想简单地实现网络文件传输,编译时可以通过,但运行时却提示错误:
Debug Assertion Failed!
Program:E:\dth\hqtran\Debug\hqtran.exe
File:afxwin2.inl
Line:168
For information on how your program can cause an assertion
failure,see the Visual C++ documetation on asserts;
(Press Retry to debug the application)
望高手不吝赐教,谢谢!zy_dth@163.com
原程序相关代码如下:// hqtranView.cpp : implementation of the CHqtranView class
//
#include "stdafx.h"
#include "hqtran.h"
#include "hqtranDoc.h"
#include "hqtranView.h"
CHqtranView::CHqtranView()
{
m_pInternetSession=new CInternetSession;
SetTimer(1,30000,NULL);
// TODO: add construction code here
}
CHqtranView::~CHqtranView()
{
KillTimer(1);
if(m_pInternetSession!=NULL)
delete m_pInternetSession;
}
void CHqtranView::OnTimer(UINT nIDEvent)
{
try
{
m_pFtpConnection=m_pInternetSession->GetFtpConnection("ftp.microsoft.com");
}
catch(CInternetException* pEx)
{
pEx->Delete();
m_pFtpConnection=NULL;
}
m_pFtpConnection->PutFile("test.txt","test.txt");
// TODO: Add your message handler code here and/or call default
CView::OnTimer(nIDEvent);
}