FtpGetFile函数下载不到最新文件Solution
来源:互联网 发布:php exec w3c 编辑:程序博客网 时间:2024/05/17 07:54
因cache缓冲问题,之前最近时间下载过,远端文件修改后在下载下载不到最新文件,在FLAG中加入属性INTERNET_FLAG_RELOAD(强制从远端下载)即可,具体如下:
MSDN原文 相关部分已加红
FtpGetFile Function
Retrieves a file from the FTP server and stores it under the specified file name, creating a new local file in the process.
Syntax
BOOL FtpGetFile( HINTERNET hConnect, LPCTSTR lpszRemoteFile, LPCTSTR lpszNewFile, BOOL fFailIfExists, DWORD dwFlagsAndAttributes, DWORD dwFlags, DWORD_PTR dwContext);
Parameters
- hConnect
- [in] Valid handle to an FTP session.
- lpszRemoteFile
- [in] Pointer to a null-terminated string that contains the name of the file to retrieve from the remote system.
- lpszNewFile
- [in] Pointer to a null-terminated string that contains the name of the file to create on the local system.
- fFailIfExists
- [in] BOOL that indicates whether the function should proceed if a local file of the specified name already exists. IffFailIfExists is TRUE and the local file exists, FtpGetFile fails.
- dwFlagsAndAttributes
- [in] Unsigned long integer value that contains the file attributes for the new file. This can be any combination of the FILE_ATTRIBUTE_* flags used by theCreateFile function. For more information on FILE_ATTRIBUTE_* attributes, seeCreateFile in the Platform SDK.
- dwFlags
- [in] Unsigned long integer value that contains the flags that control how the function will handle the file download. The first set of flag values indicates the conditions under which the transfer occurs. These transfer type flags can be used in combination with the second set of flags that control caching.
- The application can select one of these transfer type values:
- FTP_TRANSFER_TYPE_ASCII
- Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
- FTP_TRANSFER_TYPE_BINARY
- Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.
- FTP_TRANSFER_TYPE_UNKNOWN
- Defaults to FTP_TRANSFER_TYPE_BINARY.
- INTERNET_FLAG_TRANSFER_ASCII
- Transfers the file as ASCII.
- INTERNET_FLAG_TRANSFER_BINARY
- Transfers the file as binary.
The following flags determine how the caching of this file will be done. Any combination of the following flags can be used with the transfer type flag. The possible values are:
- INTERNET_FLAG_HYPERLINK
- Forces a reload if there was no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network.
- INTERNET_FLAG_NEED_FILE
- Causes a temporary file to be created if the file cannot be cached.
- INTERNET_FLAG_RELOAD
- Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.
- INTERNET_FLAG_RESYNCHRONIZE
- Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP and Gopher resources are reloaded.
- dwContext
- [in] Pointer to an unsigned long integer value that contains the application-defined value that associates this search with any application data. This is used only if the application has already calledInternetSetStatusCallback to set up a status callback function.
Return Value
Returns TRUE if successful, or FALSE otherwise. To get a specific error message, callGetLastError .
Remarks
FtpGetFile is a high-level routine that handles all the bookkeeping and overhead associated with reading a file from an FTP server and storing it locally. An application that needs to retrieve file data only or that requires close control over the file transfer should use theFtpOpenFile and InternetReadFile functions.
If the dwFlags parameter specifies FILE_TRANSFER_TYPE_ASCII, translation of the file data converts control and formatting characters to local equivalents. The default transfer is binary mode, where the file is downloaded in the same format as it is stored on the server.
Both lpszRemoteFile and lpszNewFile can be either partially or fully qualified file names relative to the current directory.
Function Information
Stock Implementation wininet.dllCustom Implementation NoHeader Wininet.hImport library Wininet.libMinimum availability Internet Explorer 3.0Minimum operating systems Windows NT 4.0, Windows 95, Windows CE 2.12
- FtpGetFile函数下载不到最新文件Solution
- FtpGetFile获得相同的文件
- 最新---java多线程下载文件
- 当你从网上下载不到文件或者下载不到正确的文件
- 批处理从FTP下载 最新文件
- 解决java网络下载获取不到文件长度
- 解决java网络下载获取不到文件长度
- C#下载文件函数
- 文件下载函数
- 文件下载函数
- 下载文件函数
- 文件下载函数
- PHP 文件下载函数
- 文件下载函数
- php文件下载函数
- php下载文件函数
- 通用文件下载函数
- php文件下载函数
- 17. Letter Combinations of a Phone Number
- 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.getJSON()
- 运动目标跟踪(一)--搜索算法预测模型之KF,EKF,UKF
- 生成全排列示例
- Android UI之switch的thumb与track属性定制自己的switch
- FtpGetFile函数下载不到最新文件Solution
- 运动目标跟踪(二)--搜索算法预测模型之粒子滤波
- springboot-aop访问拦截
- 类——类的复用(组合、继承、代理)
- Android 观察者与被观察者
- 错误处理页例子
- iOS 进度框(一) MBProgressHUD
- 运动目标跟踪(三)--搜索算法优化搜索方向之Meanshift
- 详细探究Spark的shuffle实现和hadoop mapreduce shuffle原理