标签:
// winFtpPutFiles.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
#include<windows.h>
#include<wininet.h>
#pragma comment(lib, "Wininet")
void FileSubmit()
{
HINTERNET hInternet;
HINTERNET hFtpSession;
hInternet = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if (hInternet == NULL)
{
cout << "Error: " << GetLastError();
}
else
{
hFtpSession = InternetConnectA(hInternet, "10.3.19.173", INTERNET_DEFAULT_FTP_PORT, "pc-soft7", "123", INTERNET_SERVICE_FTP, 0, 0);
if (hFtpSession == NULL)
{
cout << "Error: " << GetLastError();
}
else
{
if (!FtpGetFileA(hFtpSession, "D://file-upload.txt", "/file-test.txt", FTP_TRANSFER_TYPE_BINARY, 0))//FtpPutFileA
{
cout << "Error: " << GetLastError();
}
}
}
}
int _tmain(int argc, _TCHAR* argv[])
{
FileSubmit();
return 0;
}
标签:
原文地址:http://www.cnblogs.com/hqu-ye/p/5054066.html