# include <stdio.h>
# include <conio.h>
# include <dos.h>
void GetSystemDate( );
void SetSystemDate( );
int main( )
{
clrscr( );
printf(" Current System Date is :: ");
GetSystemDate( );
printf("\n Setting new System Date....");
SetSystemDate( );
printf("\n New System Date is :: ");
GetSystemDate( );
getch( );
return 0;
}
/* GetSystemDate( ) --*/
void GetSystemDate( )
{
union REGS InReg;
union REGS OutReg;
InReg.h.ah=0x2A;
int86(0x21,&InReg,&OutReg);
printf("%d-%d-%d",OutReg.h.dl,OutReg.h.dh,OutReg.x.cx);
}
/*SetSystemDate( ) --*/
void SetSystemDate( )
{
union REGS InReg;
union REGS OutReg;
InReg.h.ah=0x2B;
InReg.h.dl=01;
InReg.h.dh=01;
InReg.x.cx=2004;
int86(0x21,&InReg,&OutReg);
}
Output:
Current System Date is :: 4-28-2013
Setting new System Date....
New System Date is :: 4-28-2013
0 Comments