home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / DOSGFTIM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.1 KB  |  73 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - dosgftim.c
  3.  *
  4.  * function(s)
  5.  *        _dos_getftime - gets file date and time (MSC compatible)
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1991, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <_io.h>
  18. #include <dos.h>
  19.  
  20. /*--------------------------------------------------------------------------*
  21.  
  22. Name            _dos_getftime - gets file date and time
  23.  
  24. Usage           #include <dos.h>
  25.                 unsigned _dos_getftime(int handle, unsigned *date,
  26.                          unsigned *time);
  27.  
  28. Related
  29. functions       _dos_setftime
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description     _dos_getftime retrieves the file time and date for the
  34.                 disk file associated with the open handle, storing them
  35.                 at *time and *date.
  36.  
  37.                 Time bits       Meaning
  38.                 ---------       -------
  39.                 0-4             Number of 2-second increment (0-99)
  40.                 5-10            Minutes (0-59)
  41.                 11-15           Hours (0-23)
  42.  
  43.                 Date bits       Meaning
  44.                 ---------       -------
  45.                 0-4             Day (1-31)
  46.                 5-8             Month (1-12)
  47.                 9-15            Year (1980-2099)
  48.  
  49.  
  50. Return value    On success, 0 is returned.
  51.  
  52.                 In the event of an error return, the DOS error code
  53.                 is returned and the global variable errno is set to:
  54.  
  55.                         EBADF           Bad file number
  56.  
  57. *---------------------------------------------------------------------------*/
  58.  
  59. unsigned _dos_getftime(int fd, unsigned *date, unsigned *time)
  60. {
  61.     _AX = 0x5700;
  62.     _BX = fd;
  63.     geninterrupt(0x21);
  64.     if (_FLAGS & 1)                     /* if carry flag set, error */
  65.         return (__DOSerror(_AX));       /* set errno */
  66.     else
  67.     {
  68.         *date = _DX;
  69.         *time = _CX;
  70.         return (0);
  71.     }
  72. }
  73.