setdate()
Gets or sets DOS system date
Declaration:
void setdate(struct date *datep);
Remarks:
setdate sets the system date to the date in *datep.
Return Value:
getdate: None
On success, returns 0
Otherwise, returns a non-zero value and
sets errno to EINVAL (Invalid date)
Program
#include <stdio.h> #include <process.h> #include <dos.h> int main(void) { struct date reset; struct date save_date; getdate(&save_date); printf("Original date:\n"); system("date"); reset.da_year = 2001; reset.da_day = 1; reset.da_mon = 1; setdate(&reset); printf("Date after setting:\n"); system("date"); setdate(&save_date); printf("Back to original date:\n"); system("date"); return 0; } |
0 comments:
Post a Comment