windows FTP上传
TCHAR tcFileName[MAX_PATH * 4] = {L"visio2010永久安装密钥.txt"};
TCHAR tcName[MAX_PATH * 4] = {0};
wcscpy(tcName, AfxGetAppName());
CInternetSession sess(tcName);
CFtpConnection *pFTP = sess.GetFtpConnection(L"192.168.1.87");//FTP服务器地址
TCHAR tcPath[MAX_PATH * 4] = {0};
DWORD dwLength = MAX_PATH * 4;
if(!pFTP->GetCurrentDirectory(tcPath, &dwLength)){
printf("GetCurrentDirectory failed with error %d\n", GetLastError());
}
if(!pFTP->SetCurrentDirectory(L"//")){//根目录,如果需要子目录,在后面添加子目录
printf("SetCurrentDirectory failed with error %d\n", GetLastError());
}
CFtpFileFind ftpfind(pFTP);
while (true){
if(ftpfind.FindFile(tcFileName)){
printf("找到文件\n");
break;
}
}
if(!pFTP->GetFile(tcFileName, L"E:\\visio2010永久安装密钥.txt"), 0){//文件类型要匹配,下载
printf("GetFile failed with error %d\n", GetLastError());
}
if(!pFTP->PutFile(L"E:\\PL-2303 Vista Driver Installer.rar", L"PL-2303 Vista Driver Installer.rar")){
printf("PutFile failed with error %d\n", GetLastError());
}
//CInternetFile *netFile = pFTP->OpenFile(L"FeiQ.1060559168.exe");
//netFile->Write();
sess.Close();
不可以使用在工程中,因为可能有内存泄漏,写得不好。。。
版权声明:本文为博主原创文章,未经博主允许不得转载。
windows FTP上传的更多相关文章
- windows系统下ftp上传下载和一些常用命令
先假设一个ftp地址 用户名 密码 FTP Server: home4u.at.china.com User: yepanghuang Password: abc123 打开windows的开始菜单, ...
- windows下ftp上传下载和一些常用命令
先假设一个ftp地址 用户名 密码 FTP Server: home4u.at.china.com User: yepanghuang Password: abc123 打开windows的开始菜单, ...
- windows下定时利用bat脚本实现ftp上传和下载
前言: 工作中可能会遇到以下情况,利用windows作为中转,来实现两台linux服务器的文件传输. 实现步骤: 1.FTP上传和下载的bat脚本. 脚本分为两部分:可执行bat脚本和ftp命令文件: ...
- FTP上传文件到服务器
一.初始化上传控件. 1.我们这里用dropzone.js作为上传控件,下载地址http://www.dropzonejs.com/ 2.这里我们使用一个div元素作为dropzone载体. < ...
- JAVA 实现FTP上传下载(sun.net.ftp.FtpClient)
package com.why.ftp; import java.io.DataInputStream; import java.io.File; import java.io.FileInputSt ...
- 记一次FTP上传文件总是超时的解决过程
好久没写博,还是重拾记录一下吧. 背景:买了一个阿里云的云虚拟机用来搭建网站(起初不了解云虚拟主机和云服务器的区别,以为都是有SSH功能的,后来发现不是这样样子啊,云虚拟机就是FTP上传网页+MySQ ...
- FTP上传与下载
1.连接 先假设一个ftp地址 用户名 密码 FTP Server: 192.168.1.125 User: administrator Password: abc123 2. 打开win ...
- 在附件管理模块中增加对FTP 上传和预览的支持
在之前介绍的附件管理模块里面<Winform开发框架之通用附件管理模块>以及<Winform开发框架之附件管理应用>,介绍了附件的管理功能,通过对数据库记录的处理和文件的管理, ...
- FTP上传文件,报错java.net.SocketException: Software caused connection abort: recv failed
FTP上传功能,使用之前写的代码,一直上传都没有问题,今天突然报这个错误: java.net.SocketException: Software caused connection abort: re ...
随机推荐
- impala invalidate metadata和impala-shell -r作用相同
impala的invalidate metadata内部命令,是否和外部命令impala-shell -r的作用相同的? 这个问题的回答: 在invalidate metadata 和 impala- ...
- express - 快速构建项目
1,cnpm i express -g 2, cnpm i express-generater -g 3, express - e 项目名
- 微信小程序-发送模板消息
1 添加一个小程序的消息模板,获取到模板id,存储到数据库中,方便以后修改调用 2. https://developers.weixin.qq.com/miniprogram/dev/api-back ...
- 023、MySQL取文本长度取字符串长度
#取文本长度,一个文字算1长度 SELECT CHAR_LENGTH('田攀520'); #UTF-8的数据库,值为5 #取文本长度,汉字算多个字符,数字和英文算一个字符 SELECT LENGTH( ...
- 3-安装RabbitMQ
1. 安装erlang 1.1 下载erlang http://www.erlang.org/downloads/20.1 yum -y install make ncurses-devel gcc ...
- c# GlobalAddAtom GlobalDeleteAtom
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- 树莓派—raspbian软件源
零.一键换源 2018.05.18更新:新的默认源为raspbian.raspberrypi.org 因此一键换源相应改为 sudo sed -i 's#://raspbian.raspberrypi ...
- pyhton matplotlib可视化图像基础(二维函数图、柱状图、饼图、直方图以及折线图)
//2019.07.22pyhton中matplotlib模块的应用pyhton中matplotlib是可视化图像库的第三方库,它可以实现图像的可视化,输出不同形式的图形1.可视化图形的输出和展示需要 ...
- POJ 3252:Round Numbers
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 36 ...
- C#与unity中base64string和图片互转
C#: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst ...