FtpGetFile函数下载不到最新文件Solution

由于缓存问题,FtpGetFile在远端文件更新后可能无法下载到最新版本。通过在FLAG参数中添加INTERNET_FLAG_RELOAD,可以强制从服务器重新下载。这样能确保获取到最新的文件内容。MSDN建议使用FtpOpenFile和InternetReadFile函数进行更细粒度的控制,但FtpGetFile适用于简化文件下载操作。
摘要由CSDN通过智能技术生成

因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<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值