wini -- FileSubmitByFTP
2015-12-17 14:30
597 查看
// 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;
}
//
#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;
}
相关文章推荐
- 深入理解PHP7之zval
- 如何让IIS支持php网页
- Strongswan与Andriod野蛮模式L2TPoverIPsec对接有时候不成功。
- E9天嵌i.mx6q的nfs和tftp环境搭建
- Mac 下配置php环境
- ThinkPHP中_after_update、_before_update等的用法
- php函数小汇总(五)
- php中的魔术方法
- phpstorm类似sublime ctrl + alt +down多光标下移
- PHP对数组的常用处理
- thinkphp3.2 验证码生成和点击刷新验证码示例
- 编译安装LAMP实现PHP作为模块、FastCGI分离等方式
- PHP调用WebService
- PHP AJAX JSONP实现跨域请求使用实例
- PHP--获取响应头(Response Header)方法
- php继承
- Slope One协同推荐算法php代码
- PHP命名空间(Namespace)的使用详解(转)
- php学习日记第六棒(PHP 开发环境的搭建)
- 74. PHP 计数器