那位高手能提供下面几个函数的使用例子InternetOpen 初始化 Win32 internet
InternetConnect 打开一个FTP, HTTP, or Gopher 应用会话
FtpCreateDirectory 在服务器上建立一个新的目录
FtpRemoveDirectory 删除服务器上的一个目录
FtpOpenFile 打开服务器上的一个文件进行读写
FtpGetFile 接收指定的文件并且在本地建立它
FtpPutFile 发送指定文件到服务器
FtpDeleteFile 删除服务器上一个指定的文件
FtpSetCurrentDirectory 设置服务器上当前的工作目录
FtpGetCurrentDirectory 返回服务器当前的工作目录
FtpCommand 发送命令到服务器
FtpFindFirstFile 返回文件信息。放在 WIN32_FIND_DATA 结构中
InternetFindNextFile 调用 FtpFindFirstFile()后在目录中连续查找
FtpRenameFile 修改服务器上指定的文件的名字
InternetConnect 打开一个FTP, HTTP, or Gopher 应用会话
FtpCreateDirectory 在服务器上建立一个新的目录
FtpRemoveDirectory 删除服务器上的一个目录
FtpOpenFile 打开服务器上的一个文件进行读写
FtpGetFile 接收指定的文件并且在本地建立它
FtpPutFile 发送指定文件到服务器
FtpDeleteFile 删除服务器上一个指定的文件
FtpSetCurrentDirectory 设置服务器上当前的工作目录
FtpGetCurrentDirectory 返回服务器当前的工作目录
FtpCommand 发送命令到服务器
FtpFindFirstFile 返回文件信息。放在 WIN32_FIND_DATA 结构中
InternetFindNextFile 调用 FtpFindFirstFile()后在目录中连续查找
FtpRenameFile 修改服务器上指定的文件的名字
解决方案 »
- vs2008sp1 急求CMFCPropertyGridCtrl的使用,进者有分!
- 消息传递的问题?
- 关于ActiveX的旷世难题,高手请进,在线急等之~~~~~~~~~
- 问点菜鸟问题
- 怎么样不用SDK实现一个基本窗口
- 为什么在vc连接出的程序没有问题,但是把他提到debug文件夹外就出问题,静态连接也一样
- 使用InstallShield制作安装盘,安装后不能卸载
- 诧异的fread fwrite fseek文件操作
- 急 急 急 。。。。监控服务器状态,状态关闭时可以自动重启...这样的程序代码应该怎么写哦????
- 模拟按键是怎么实现的
- (对于我很难的,高手进)图标的读取问题
- 大家帮帮忙这个字符串怎么解析
比如搜一下FtpCreateDirectory这个函数
就看到了一个例子Creating a Synchronous Example
Suppose that you want to connect to an FTP server called ftp://ftp.infosite.com and copy all of the .ZIP files from its /BIN subdirectory to your local hard drive and store them in your C:\ZIPFILES subdirectory. The sample code might look like this:HINTERNET hInternetSession; // handle to internet connection
HINTERNET hFTPSession; // handle to FTP session
HINTERNET hFileConnection; // handle to file enumeration
WIN32_FIND_DATA sWFD; // structure to hold FIND data
BOOL bResult = TRUE; // Boolean for return code
CString InputSpec; // variable to hold input spec
Cstring OutputSpec; // variable to hold output spechInternetSession = InternetOpen(
"Microsoft Internet Explorer", // agent
INTERNET_OPEN_TYPE_PROXY, // access
"ftp-gw", // proxy server
NULL, // defaults
0); // synchronous// Make connection to ftp server.
hFTPSession = ::InternetConnect(
hInternetSession, // Handle from a previous
// call to InternetOpen.
"ftp://ftp.infosite.com", // Server we want to connect to
INTERNET_INVALID_PORT_NUMBER, // Use appropriate port.
NULL, // Use anonymous for username.
NULL, // Use e-mail name for password
INTERNET_SERVICE_FTP, // Flag to use FTP services
0, // Flags (see SDK docs)
0); // Synchronous mode// Find first .ZIP file.
hFileConnection = ::FtpFindFirstFile(
hFTPSession,
"*.ZIP",
&sWFD,
0,
0);
if (hFileConnection != (HINTERNET)NULL)
{
::FtpSetCurrentDirectory(hFTPSession, "/BIN"); while (bResult)
{
// Create file specs.
InputSpec = "ftp://ftp.infosite.com/BIN/";
InputSpec = InputSpec + sWFD.cFileName;
OutputSpec = "c:\zipfiles\";
OutputSpec = OutputSpec + sWFD.cFileName; // Transfer the file.
bResult = ::FtpGetFile(
hFTPSession,
InputSpec,
OutputSpec,
FALSE,
FILE_ATTRIBUTE_NORMAL,
FTP_TRANSFER_TYPE_BINARY,
0); // Get next file.
bResult = ::InternetFindNextFile(
hFileConnection,
&sWFD);
}
}// Close connections.
InternetCloseHandle(hFileConnection);
InternetCloseHandle(hFTPSession);
InternetCloseHandle(hInternetSession);