資源簡介
windows下c++語言實現的FTP客戶端
FTP客戶端使用c++語言實現,并可在vs2010中直接運行,功能包括創建文件、刪除文件、
上傳與下載,經測試文件類型和大小需自己個人定義,代碼可供參考。
代碼片段和文件信息
#include“FTPClient.h“
#include
using?namespace?std;
void?main(int?argc?char*?argv[])
{
SetConsoletitleA(“FTP客戶端控制臺版?v1.1“);
FTPClient?ftp;?//定義FTP對象
//檢查命令行參數
if?(argc?!=?2)
{
cout?<“請輸入FTP服務器IP地址:“;
string?ab;
ftp.subcommend(ab);?
while(!(?const_cast(a.c_str())))
{
cout<<“連接失敗!請檢查輸入是否正確!“< ftp.subcommend(ab);
}
if(ftp.FTPConnection(const_cast(a.c_str())21))
{
bool?flag;
do
{
ftp.useuser();
flag=ftp.usepass();
}while(!flag);
cout?<<“提示:help命令可獲取幫助!“< cout?< while(true)
{
cout<<“FTP>“;
string?orderdetail;
ftp.subcommend(orderdetail);
if(detail.length()!=0)
{
memset(ftp.CmdBuf0MAX_SIZE);
memcpy(ftp.CmdBufdetail.data()detail.length());
ftp.ishavedetail=true;
}
if(order==“ls“)
ftp.listftp(const_cast(a.c_str()));
else?if(order==“stor“)
ftp.storfile(const_cast(a.c_str()));
else?if(order==“retr“)
ftp.retrfile(const_cast(a.c_str()));
else?if(order==“cwd“)
ftp.changedir();
else?if(order==“mkd“)
ftp.mkdirectory();
else?if(order==“help“)
ftp.help();
else?if(order==“dele“)
ftp.deletefile();
else?if(order==“about“)
ftp.about();
else?if(order==“quit“)
{
ftp.quitftp();
break;
}
else?if(order==“user“)
{
bool?flag;
do
{
ftp.useuser();
flag=ftp.usepass();
}while(!flag);
}
else
{
cout?<<“FTP>無此命令!幫助請輸入help!“< }
ftp.ishavedetail=false;
}
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????111616??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\Debug\FtpClient.exe
?????文件?????723356??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\Debug\FtpClient.ilk
?????文件?????855040??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\Debug\FtpClient.pdb
?????文件???????1735??2017-08-21?10:10??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\ClientMain.cpp
?????文件???????1298??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\cl.command.1.tlog
?????文件??????43976??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\CL.read.1.tlog
?????文件???????1212??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\CL.write.1.tlog
?????文件?????110215??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\ClientMain.obj
?????文件????????381??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FtpClient.exe.intermediate.manifest
?????文件?????????87??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FtpClient.lastbuildstate
?????文件???????4084??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FtpClient.log
?????文件?????299956??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FTPClient.obj
?????文件????????713??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FtpClient.vcxprojResolveAssemblyReference.cache
?????文件??????????0??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\FtpClient.write.1.tlog
?????文件???????1540??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\li
?????文件???????3160??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\li
?????文件????????936??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\li
?????文件????????524??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\mt.command.1.tlog
?????文件????????596??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\mt.read.1.tlog
?????文件????????812??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\mt.read.2.tlog
?????文件????????344??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\mt.write.1.tlog
?????文件?????723968??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\vc100.idb
?????文件?????315392??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\Debug\vc100.pdb
?????文件??????14654??2017-08-21?10:09??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\FTPClient.cpp
?????文件???????1287??2017-08-21?11:23??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\FTPClient.h
?????文件???????3344??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\FtpClient.vcxproj
?????文件???????1163??2017-08-21?10:16??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\FtpClient.vcxproj.filters
?????文件????????143??2017-08-21?09:51??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\FtpClient.vcxproj.user
?????文件?????????12??2017-08-21?10:46??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient\test.txt
?????文件???28725248??2017-08-21?11:23??windows下c++語言實現的FTP客戶端\FtpClient\FtpClient.sdf
............此處省略14個文件信息
- 上一篇:C++中文離線手冊修正版
- 下一篇:mesh簡化實現——邊折疊算法
評論
共有 條評論