- 论坛徽章:
- 1
|
本帖最后由 framily 于 2015-08-18 12:53 编辑
void CMFCApplication1Dlg::FileUpload(LPCTSTR serverName, unsigned short port, LPCTSTR username, LPCTSTR password, LPCTSTR localFileName, LPCTSTR serverFileName)
{
CInternetSession InetSession;
CFtpConnection *ftp = nullptr;
try{
ftp = InetSession.GetFtpConnection(serverName, username, password, port, 1);
}
catch (CInternetException *pEx){
MessageBox(_T("不能连接服务器!请确认服务已开启"), _T("错误"));
InetSession.Close();
if (ftp != NULL)
{
delete ftp;
ftp = NULL;
}
pEx->Delete();
return;
}
bool b = FtpPutFile(ftp, localFileName, serverFileName, FTP_TRANSFER_TYPE_BINARY, 0);
int n = GetLastError();
cout << b << endl;
}
n = 6,,通过错误查找工具发现错误提示是句柄无效,求教,怎么回事,怎么改?? |
|