中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » _dos_findfirst()_dos_findnext()得来的文件时间问题
作者:
标题: _dos_findfirst()_dos_findnext()得来的文件时间问题 上一主题 | 下一主题
linzhixiao
初级用户




积分 160
发帖 15
注册 2004-1-6
状态 离线
『楼 主』:  _dos_findfirst()_dos_findnext()得来的文件时间问题

用_dos_findfirst()与_dos_findnext()函数得来的文件时间问题 struct find_t { char reserved[21]; /* reserved for use by DOS */ char attrib; /* attribute byte for file */ unsigned short wr_time; /* time of last write to file*/ unsigned short wr_date; /* date of last write to file*/ unsigned long size; /* length of file in bytes */ #if defined(__OS2__) || defined(__NT__) char name[256]; /* null-terminated filename */ #else char name[13]; /* null-terminated filename */ #endif }; 这个结构中的wr_date,wr_time字段,是日期跟时间,但它们是一个短整数(16位), 不是传统下的2004-05-22,与24:23:09这样的格式,请问高手如何能转换成这 样的格式,C语言中有没有现成的函数,或者如何再一个转换函数。 wr_date,wr_time中是这样的(如下结构) typedef struct { unsigned short twosecs : 5(0-4位); /* seconds / 2 */ unsigned short minutes : 6(5-19位); /* minutes (0,59) */ unsigned short hours : 5;(11-15位) /* hours (0,23) */ } ftime_t; typedef struct { unsigned short day : 5(0-4位); /* day (1,31) */ unsigned short month : 4;(5-8位) /* month (1,12) */ unsigned short year : 7;(9-位15) /* 0 is 1980 */ } fdate_t;


2004-5-22 00:00
查看资料  发送邮件  发短消息 网志  OICQ (5727658)  编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: