ftp查找文件
来源:互联网 发布:锦易编程助手 编辑:程序博客网 时间:2024/06/09 15:26
ftp查找文件
怎样实现在一个ftp服务器的特定目录下查找一个指定的文件是否存在?
#include
#include
#include
#include
// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GX
CWinApp theApp;
void main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return;
}
// create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel)
// will be used.
CInternetSession sess(_T("MyProgram/1.0"));
CFtpConnection* pConnect = NULL;
try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com"));
// use a file find object to enumerate files
CFtpFileFind finder(pConnect);
// start looping
BOOL bWorking = finder.FindFile(_T("*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
}
// if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect;
return;
}
Requirements
Header: afxinet.h
怎样实现在一个ftp服务器的特定目录下查找一个指定的文件是否存在?
#include
#include
#include
#include
// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GX
CWinApp theApp;
void main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return;
}
// create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel)
// will be used.
CInternetSession sess(_T("MyProgram/1.0"));
CFtpConnection* pConnect = NULL;
try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com"));
// use a file find object to enumerate files
CFtpFileFind finder(pConnect);
// start looping
BOOL bWorking = finder.FindFile(_T("*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
}
// if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect;
return;
}
Requirements
Header: afxinet.h
- ftp查找文件
- QT查找监控FTP
- 查找文件
- 查找文件
- 文件查找
- 文件查找
- 查找文件
- 查找文件
- 查找文件
- 查找文件
- 查找文件
- 文件查找
- 文件查找
- 文件查找
- 文件查找
- 文件查找
- 查找文件
- python---项目2-查找服务器是否开启ftp的21端口,socket,os,sys,端口识别,文件操作
- easy network programming with damn cool indy
- 得到一个系统的所有信息
- 很好的博客
- 已知ftp上的一个文件完整路径,在idftp中是否可以测试该文件是否存在!
- 投资回报和一个自由现金流的增长率
- ftp查找文件
- 《Windows程序设计》之按钮
- java.sql.SQLException: Io 异常: Got minus one from a read call解决综合
- form.js官方插件介绍
- link error Unable to open file 'dclusr50.lib'
- DBGrid多行选择
- StringReplace
- eclipse修改workspace
- Spring Mvc实现文件的上传和下载,将文件直接读取到数据库