DTINF.C
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
- #include <stdio.h>
- #include <dos.h>
- void main (void)
- {
- struct date curr_date;
- struct time curr_time;
- FILE *input;
-
- if ((input = fopen("DATETIME.OUT", "r")) == NULL)
- fprintf(stderr, "Error opening file DATETIME.OUTn");
- else
- {
- fread(&curr_date, sizeof(curr_date), 1, input);
- fread(&curr_time, sizeof(curr_time), 1, input);
- fclose(input);
- printf("Date: %02d-%02d-%02dn", curr_date.da_mon,
- curr_date.da_day, curr_date.da_year);
- printf("Time: %02d:%02dn", curr_time.ti_hour,
- curr_time.ti_min);
- }
- }