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

  1. /**
  2. *
  3. * Name        drsetstp -- Set date/time stamp of open file
  4. *
  5. * Synopsis    ercode = drsetstp(handle,fdate,ftime);
  6. *
  7. *        int ercode      DOS function error code
  8. *        int handle      File handle of open file
  9. *        unsigned fdate      Date to set
  10. *        unsigned ftime      Time to set
  11. *
  12. * Description    This function sets the date and time stamp of the file
  13. *        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 DRRETSTP, DRSFIRST, and
  29. *        DRSNEXT.
  30. *
  31. *        No checking is done to ensure that the words are in the
  32. *        right format; it is the programmer's responsibility to
  33. *        guarantee that the format is proper.
  34. *
  35. *        Use DRDT2STP and DRTM2STP to create date and time
  36. *        stamps.
  37. *
  38. * Returns    ercode          DOS function return code
  39. *
  40. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  41. *
  42. **/
  43.  
  44. #include <bdirect.h>
  45. #include <butility.h>
  46.  
  47. int drsetstp(handle,fdate,ftime)
  48. int handle;
  49. unsigned fdate,ftime;
  50. {
  51.     DOSREG dos_reg;
  52.  
  53.     dos_reg.ax = 0x5701;          /* DOS function 0x57, set stamp */
  54.     dos_reg.bx = handle;
  55.     dos_reg.cx = ftime;
  56.     dos_reg.dx = fdate;
  57.  
  58.     return(dos(&dos_reg));
  59. }
  60.