Posts

Showing posts from April, 2011

C Program to Get the Current System Date

#include <dos.h> #include <stdio.h> int main(void) { struct date d; getdate(&d); printf(“The current year is: %d\n”, d.da_year); printf(“The current day is: %d\n”, d.da_day); printf(“The current month is: %d\n”, d.da_mon); return 0; }

C Program to Get the Current System Time

#include <stdio.h> #include <dos.h> int main(void) { struct time t; gettime(&t); printf(“The current time is: %2d:%02d:%02d\n”, t.ti_hour, t.ti_min, t.ti_sec); return 0; }