码迷,mamicode.com
首页 > Windows程序 > 详细

wini -- FileSubmitByFTP

时间:2015-12-17 15:43:24      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

// 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;
}

 

wini -- FileSubmitByFTP

标签:

原文地址:http://www.cnblogs.com/hqu-ye/p/5054066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!