Dos下用中断取时间的程序
Tc2.0 xp 虚拟机 下编译通过。
int21 下 ah=2a
cx是年,dh是月,dl是日。
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void time1()
{
char* cc="abab$";
int y;
int yue,ri;
union REGS regs;
union REGS inregs,outregs;
inregs.h.ah = 0x2a; /* set cursor postion */
int86(0x21, &inregs, &outregs);
y=outregs.x.cx;
yue=outregs.h.dh;
ri=outregs.h.dl;
printf("%d %d %d",y,yue,ri);
}
main()
{
time1();
}