home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / GETFTIME.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  2.4 KB  |  79 lines

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