home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 5.ddi / CLIBSRC2.ZIP / GETFTIME.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  2.4 KB  |  78 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - getftime.cas
  3.  *
  4.  * function(s)
  5.  *        getftime - gets file date and time
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <io.h>
  20. #include <_io.h>
  21.  
  22. /*--------------------------------------------------------------------------*
  23.  
  24. Name            getftime - gets file date and time
  25.  
  26. Usage           #include <dos.h>
  27.                 int getftime(int handle, struct ftime *ftimep);
  28.  
  29. Related
  30. functions usage int setftime(int handle, struct ftime *ftimep);
  31.  
  32. Prototype in    dos.h
  33.  
  34. Description     getftime retrieves the file time and date for the
  35.                 disk file associated with the open handle. The ftime
  36.                 structure pointed to by ftimep is filled in with the
  37.                 file's time and date.
  38.  
  39.                 setftime sets the file date and time of the disk file
  40.                 associated with the open handle to the date and time in the
  41.                 ftime structure pointed to by ftimep.
  42.  
  43.                 The ftime structure is defined as follows:
  44.  
  45.                 struct ftime {
  46.                         unsigned ft_tsec: 5;    (* Two seconds *)
  47.                         unsigned ft_min: 6;     (* Minutes *)
  48.                         unsigned ft_hour: 5;    (* Hours *)
  49.                         unsigned ft_day: 5;     (* Days *)
  50.                         unsigned ft_month: 4;   (* Months *)
  51.                         unsigned ft_year: 7;    (* Year - 1980 *)
  52.                 };
  53.  
  54. Return value    Both functions return 0 on success.
  55.  
  56.                 In the event of an error return, -1 is returned and the global
  57.                 variable errno is set to one of the following:
  58.  
  59.                         EINVFNC         Invalid function number
  60.                         EBADF           Bad file number
  61.  
  62. *---------------------------------------------------------------------------*/
  63. int getftime(int fd, struct ftime *ftimep)
  64. {
  65. asm     mov     ax, 05700h
  66. asm     mov     bx, fd
  67. asm     int     021h
  68. asm     jc      getftimeFailed
  69.  
  70. asm     LES_    di, ftimep
  71. asm     mov     ES_ [di], cx
  72. asm     mov     ES_ [di+2], dx
  73.         return (0);
  74.  
  75. getftimeFailed:
  76.         return __IOerror (_AX);
  77. }
  78.