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

  1. /**
  2. *
  3. * Name        qysetdat -- Set the system date
  4. *
  5. * Synopsis    ercode = qysetdat(year,month,day);
  6. *
  7. *        int ercode      1 if the date is invalid, 0 otherwise
  8. *        int year      The year (1980 - 2099) to set
  9. *        int month      The month (1 - 12) to set
  10. *        int day       The day (1 - 31) to set
  11. *
  12. * Description    QYSETDAT sets the system date to the values specified.
  13. *        If the format is invalid, the error code is returned
  14. *        with a value of 1; otherwise zero.  Note that only the
  15. *        ranges listed above are checked.  Setting the day to 31
  16. *        for the month of June, for example, is an error not
  17. *        caught.
  18. *
  19. * Returns    ercode          1 if the date is invalid, 0 otherwise
  20. *
  21. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  22. *
  23. **/
  24.  
  25. #include <bquery.h>
  26.  
  27. int qysetdat(year,month,day)
  28. int year,month,day;
  29. {
  30.     DOSREG dos_reg;
  31.  
  32.     dos_reg.ax = 0x2b00;
  33.     dos_reg.cx = year;
  34.     dos_reg.dx = utbyword(month,day);
  35.     dos(&dos_reg);
  36.  
  37.     if (utlobyte(dos_reg.ax))
  38.     return(1);
  39.  
  40.     return(0);
  41. }
  42.