#include "stdafx.h"
#include <windows.h>
#include <wininet.h>
#include <iostream>
#pragma comment(lib, "Wininet")
using namespace std;
void FileSubmit()
{
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if (hInternet == NULL)
{
cout << "Error: " << GetLastError();
}
else
{
hFtpSession = InternetConnect(hInternet, L"ftp ip address", INTERNET_DEFAULT_FTP_PORT, L"username", L"passwrod", INTERNET_SERVICE_FTP, 0, 0);
if (hFtpSession == NULL)
{
cout << "Error: " << GetLastError();
}
else
{
if (!FtpPutFile(hFtpSession, L"e://file.txt", L"/file.txt", FTP_TRANSFER_TYPE_BINARY, 0))
{
cout << L"Error: " << GetLastError();
}
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
FileSubmit();
return 0;
}
wininet 实现ftp上传
最新推荐文章于 2018-04-27 14:57:32 发布
51

被折叠的 条评论
为什么被折叠?



