JULY4_94.C
资源名称:C.rar [点击查看]
上传用户:qq5388545
上传日期:2022-07-04
资源大小:29849k
文件大小:1k
源码类别:
界面编程
开发平台:
C/C++
- #include <stdio.h>
- #include <dos.h>
- #include <fcntl.h>
- void main(int argc, char *argv[])
- {
- union {
- struct Date {
- unsigned int day:5;
- unsigned int month:4;
- unsigned int years:7;
- } bits;
- unsigned value;
- } date;
- union {
- struct Time {
- unsigned seconds:5;
- unsigned minutes:6;
- unsigned hours:5;
- } bits;
- unsigned value;
- } time;
- int handle;
- if (_dos_open(argv[1], O_RDONLY, &handle))
- fprintf(stderr, "Error opening source filen");
- else
- {
- date.bits.day = 4;
- date.bits.month = 7;
- date.bits.years = 14; // 1980 + 14
- time.bits.hours = 12;
- time.bits.minutes = 0;
- time.bits.seconds = 0;
- if (_dos_setftime(handle, date.value, time.value))
- printf("Error setting date/time stampn");
- _dos_close(handle);
- }
- }