delorie.com/djgpp/doc/libc/libc_172.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <dos.h> unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time); |
This function gets the date and time of the given file and puts these values into p_date and p_time variable. The meaning of DOS date in the p_date variable is the following:
F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits) X X X X X X X X X X X X X X X X *-----------------------* *-----------* *---------------* year month day year = 0-119 (relative to 1980) month = 1-12 day = 1-31 |
The meaning of DOS time in the p_time variable is the following:
F E D C B A 9 8 7 6 5 4 3 2 1 0 X X X X X X X X X X X X X X X X *---------------* *-------------------* *---------------* hours minutes seconds hours = 0-23 minutes = 0-59 seconds = 0-29 in two-second intervals |
See section _dos_setftime.
This function cannot be used to return last access and creation date and time, even on systems where the LFN API (see section LFN) is available. See _lfn_get_ftime, for a function that can be used to get the other two times. Also see fstat, which is Posix-standard.
Returns 0 if successful and return DOS error on error (and sets
errno
=EBADF).
ANSI/ISO C | No |
POSIX | No |
unsigned int handle, date, time; _dos_open("FOO.DAT", O_RDWR, &handle); _dos_getftime(handle, &date, &time); _dos_close(handle); printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n", /* year month day */ ((date >> 9) & 0x7F) + 1980U, (date >> 5) & 0x0F, date & 0x1F, /* hour minute second */ (time >> 11) & 0x1F, (time >> 5) & 0x3F, (time & 0x1F) * 2); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |