home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / dos / compat / d_getftm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-24  |  752 b   |  38 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. /*
  3.  * D_GETFTM.C.
  4.  *
  5.  * Written by Peter Sulyok 1995 <sulyok@math.klte.hu>.
  6.  *
  7.  * This file is distributed WITHOUT ANY WARRANTY; without even the implied
  8.  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9.  *
  10.  */
  11.  
  12. #include <dpmi.h>
  13. #include <errno.h>
  14. #include <dos.h>
  15.  
  16. unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned int *p_time)
  17. {
  18.   __dpmi_regs r;
  19.  
  20.   if (p_date == 0 || p_time == 0)
  21.   {
  22.     errno = EINVAL;
  23.     return -1;
  24.   }
  25.  
  26.   r.x.ax = 0x5700;
  27.   r.x.bx = handle;
  28.   __dpmi_int(0x21, &r);
  29.   if ( r.x.flags & 1 )
  30.   {
  31.     errno = EBADF;
  32.     return r.x.ax;
  33.   }
  34.   *p_time = r.x.cx;
  35.   *p_date = r.x.dx;
  36.   return 0;
  37. }
  38.