Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_dos_setdate() set the system date</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _dos_setdate()          Set the system date

 #include   <dos.h>

  unsigned     _dos_setdate(date);
  struct dosdate_t *date;     Location of information about new date

    _dos_setdate() uses MS-DOS function 2Bh to set the current system
    date. Before calling _dos_setdate() the new date must be stored in
    struct dosdate_t, defined in dos.h:

           struct dosdate_t {
              unsigned char day;         1-31
              unsigned char month;       1-12
              unsigned int year;         1980-2099
              unsigned char dayofweek;   0-6 (0 = Sunday)
              }

    Returns:    _dos_setdate() returns 0 if successful, otherwise it
                returns a nonzero value and sets errno to EINVAL to
                indicate that an invalid date was specified.

   Portability:     MS-DOS only, version 1.0 or higher

------------------------------- Example ---------------------------------

 This program sets the system date to October 12, 1988

           #include <dos.h>

           main()
           {
              struct dosdate_t date;

              date.day = 12;
              date.month = 10;
              date.year = 1988;

              if (_dos_setdate(&date) == 0)
                 printf("The new date is %d-%d-%d\n", date.month, date.day,
                        date.year);
              else
                 printf("Invalid date specified");
           }


See Also: _dos_getdate() _dos_settime()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson