home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / DRRETSTP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  1.6 KB  |  60 lines

  1. /**
  2. *
  3. * Name        drretstp -- Return date/time stamp of open file
  4. *
  5. * Synopsis    ercode = drretstp(handle,pfdate,pftime);
  6. *
  7. *        int ercode      DOS function return error code
  8. *        int handle      File handle of open file
  9. *        unsigned *pfdate  Pointer to returned date stamp
  10. *        unsigned *pftime  Pointer to returned time stamp
  11. *
  12. * Description    This function returns the date and time stamp of the
  13. *        file associated with the specified handle.
  14. *
  15. *        The date and time are represented as 16-bit quantities
  16. *        in the following format:
  17. *
  18. *              **********   bits   ***********
  19. *              1 1 1 1 1 1
  20. *              5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  21. *
  22. *              y y y y y y y m m m m d d d d d    = fdate
  23. *
  24. *              h h h h h m m m m m m s s s s s    = ftime
  25. *
  26. *        where the year bits represent 0 - 119 (1980 to 2099) and
  27. *        the second bits represent two-second increments.  This
  28. *        is the same format used by DRSETSTP, DRSFIRST, and
  29. *        DRSNEXT.
  30. *
  31. *        Use DRSTP2DT and DRSTP2TM to split the time and date
  32. *        stamps into year, month, day, etc.
  33. *
  34. * Returns    ercode          DOS error code
  35. *        *pfdate       File date stamp
  36. *        *pftime       File time stamp
  37. *
  38. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  39. *
  40. **/
  41.  
  42. #include <bdirect.h>
  43. #include <butility.h>
  44.  
  45. int drretstp(handle,pfdate,pftime)
  46. int handle;
  47. unsigned *pfdate,*pftime;
  48. {
  49.     DOSREG dos_reg;
  50.     int    ercode;
  51.  
  52.     dos_reg.ax = 0x5700;          /* Function 0x57, return stamp  */
  53.     dos_reg.bx = handle;
  54.     ercode     = dos(&dos_reg);
  55.     *pftime    = dos_reg.cx;
  56.     *pfdate    = dos_reg.dx;
  57.  
  58.     return(ercode);
  59. }
  60.