怎样才能,取得文件更新时间?

liyc 2001-07-05 09:47:04
声明:function boolean GetFileTime(long hfile,filetime f1,filetime f2,filetime f3) library "kernel32.dll"
long fhandle
boolean rtn
filetime f1,f2,f3
fhandle=fileopen("d:\test.exe")
rtn=GetFileTime(fhandle,f1,f2,f3)
fileclose(fhandle)
调试时fileopen成功,但getfiletime总是失败,请大侠指教!!!

...全文
184 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
szjlq 2001-07-05
  • 打赏
  • 举报
回复
PB的fileopen返回的是一个文件号(file number),象以前DOS下的BASIC的#1,#2
API的openfile返回的是一个文件句柄。
liyc 2001-07-05
  • 打赏
  • 举报
回复
to:szjlq
谢谢老兄,pb的fileopen()与api的openfile()有何区别,你的方法我还没试
怎么给你分呀?
wangsw 2001-07-05
  • 打赏
  • 举报
回复
真麻烦!
szjlq 2001-07-05
  • 打赏
  • 举报
回复
代码:
ulong lul_hFile
ofstruct lst_ofstruct
string ls_filename
ls_filename='c:\1.txt'
lul_hFile=openfile(ls_filename,lst_ofstruct,0)//取句柄

filetime lst_filetime1,lst_filetime2,lst_filetime3
SYSTEMTIME LST_SYSTEMTIME

GetFileTime(lul_hFile,lst_filetime1,lst_filetime3,lst_filetime3)//取时间

FileTimeToSystemTime(LST_FileTime1,LST_SYSTEMTIME)//将UTC格式转化成系统时间格式
messagebox('',string(lst_systemtime.wYear)+ '/'+string(lst_systemtime.wMonth)+'/'+string(lst_systemtime.wDay))
szjlq 2001-07-05
  • 打赏
  • 举报
回复
API:
FUNCTION ulong GetFileTime(ulong hFile,ref FILETIME lpCreationTime,ref FILETIME lpLastAccessTime,ref FILETIME lpLastWriteTime) LIBRARY "kernel32.dll"
FUNCTION ulong OpenFile(ref string lpFileName,ref OFSTRUCT lpReOpenBuff,ulong wStyle) LIBRARY "kernel32.dll"
FUNCTION ulong FileTimeToSystemTime(ref FILETIME lpFileTime,ref SYSTEMTIME lpSystemTime) LIBRARY "kernel32.dll"

szjlq 2001-07-05
  • 打赏
  • 举报
回复
type FileTime from structure
long dwLowDateTime
long dwHighDateTime
end type

type OFSTRUCT from structure
unsignedinteger cBytes
unsignedinteger fFixedDisk
integer nErrCode
integer Reserved1
integer Reserved2
character szPathName[128]
end type

type systemtime from structure
integer wYear
integer wMonth
integer wDayOfWeek
integer wDay
integer wHour
integer wMinute
integer wSecond
integer wMilliseconds
end type
Kanfu 2001-07-05
  • 打赏
  • 举报
回复
Declared in winbase.h
pbsql 2001-07-05
  • 打赏
  • 举报
回复
还是没看出来这个函数在哪个文件里头!
Kanfu 2001-07-05
  • 打赏
  • 举报
回复
GetFileTime
The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified.

BOOL GetFileTime(
HANDLE hFile, // handle to the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);

Parameters
hFile
Handle to the files for which to get dates and times. The file handle must have been created with GENERIC_READ access to the file.
lpCreationTime
Pointer to a FILETIME structure to receive the date and time the file was created. This parameter can be NULL if the application does not require this information.
lpLastAccessTime
Pointer to a FILETIME structure to receive the date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or, in the case of executable files, run. This parameter can be NULL if the application does not require this information.
lpLastWriteTime
Pointer to a FILETIME structure to receive the date and time the file was last written to. This parameter can be NULL if the application does not require this information.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks
The FAT and NTFS file systems support the file creation, last access, and last write time values.

Windows 95: The precision of the time for a file in a FAT file system is 2 seconds. The time precision for files in other file systems, such as those connected through a network depends on the file system but may also be limited by the remote device.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.

FILETIME
The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.

typedef struct _FILETIME { // ft
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;

Members
dwLowDateTime
Specifies the low-order 32 bits of the file time.
dwHighDateTime
Specifies the high-order 32 bits of the file time.
Remarks
It is not recommended that you add and subtract values from the FILETIME structure to obtain relative times. Instead, you should

Copy the resulting FILETIME structure to a LARGE_INTEGER structure.
Use normal 64-bit arithmetic on the LARGE_INTEGER value.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winbase.h.


weiqihp 2001-07-05
  • 打赏
  • 举报
回复
能详细点吗?
pbsql 2001-07-05
  • 打赏
  • 举报
回复
在哪个文件里头?
Kanfu 2001-07-05
  • 打赏
  • 举报
回复
看看函数定义:
BOOL GetFileTime(
HANDLE hFile, // handle to the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);
知道了吧!
源码链接: https://pan.quark.cn/s/8ddf8a1c92f9 **libcurl用于获取大型文件**libcurl作为一个开源的C语言库,提供了一系列的API来处理与URL相关的任务,涵盖了HTTP、FTP、SMTP等多种网络协议的应用。在执行大型文件的下载操作时,libcurl展现出卓越的性能表现和高度的灵活性,能够高效地管理大文件传输过程,有效预防内存溢出及其他潜在问题。**libcurl的基础操作**libcurl的基础应用包括以下几个环节:1. **初始化**:需要借助`curl_global_init()`函数来启动libcurl的工作环境。2. **建立会话句柄**:通过`curl_easy_init()`函数创建一个会话句柄,该句柄将用于后续所有的操作流程。3. **配置选项**:运用`curl_easy_setopt()`函数来设定多种参数,例如目标URL、超时时间、重试次数以及数据写入的回调函数等。4. **执行请求**:调用`curl_easy_perform()`函数来实施下载操作。5. **释放资源**:使用`curl_easy_cleanup()`函数来释放已经占用的资源。**获取大型文件时的重要设置**1. **数据写入回调函数**:在处理大型文件下载时,通常不希望一次性将整个文件载入内存。可以配置`CURLOPT_WRITEFUNCTION`选项,指定一个回调函数来处理接收到的数据片段,这样libcurl在接收到数据时会调用该函数,使得我们可以按需将数据写入文件或缓冲区。2. **缓冲策略**:可以设定缓冲区的大小(比如,通过`CURLOPT_BUFFERSIZE`),来控制每次接收数据的数量,从而优化内存...
内容概要:本文档整合了《鬼谷子·决篇》与《三略·审权变第三》《差德行第四》三大古代智慧典籍,构建了一套“决策+形势+用人”三位一体的领导力提升体系。通过28天三合实战路径、三维诊断工具、9个实用模板及独特的“身体锚点”仪式,系统解决管理者在决策犹豫、形势误判、人岗错配等方面的痛点。全文涵盖理论溯源、方法论拆解(如三步决策法、审权变四步法、差德行四步法)、历史案例对照(范蠡 vs 项羽)以及跨资源联动建议,形成从认知到实践的完整闭环。; 适合人群:中基层管理者、创业者、职场进阶者,尤其是面临决策困境、环境适应困难或团队用人问题的人群;具备一定管理经验或自我提升意识的个体亦可受益。; 使用场景及目标:① 提升重大事项的决策质量,避免反复纠结与事后后悔;② 增强对外部环境变化的敏感度与应对能力,实现灵活调整;③ 科学评估人才德才素质,实现人岗精准匹配,减少用人失误;④ 构建个人化的决策-应变-用人标准化流程(SOP)。; 阅读建议:建议按照28天路径逐步实践,结合自测表定位短板,优先突破薄弱模块;配套工具模板需实际填写使用,配合身体锚点仪式强化行为记忆;可与“诸葛亮决策术”“立将威信术”等单品联动,全面提升领导力体系。

1,110

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧