26.
Program to get and set system date?
Program
#include<dos.h>
#include<conio.h>
#include<stdio.h>
void main()
{
union REGS in,out;
clrscr();
/*----date, month and year are in DL,DH and CX registers respectively----*/
/*-----Getting the System Date-----*/
in.h.ah=0X2A;
int86(0X21,&in,&out);
printf("\nCURRENT SYSTEM DATE:%d- %d- %d",out.h.dl,out.h.dh,out.x.cx);
/*-----Setting the System Date----*/
printf("\nENTER NEW DATE:");
printf("\nDAY:");
scanf("%d",&in.h.dl);
printf("\nMONTH:");
scanf("%d",&in.h.dh);
printf("\nYEAR:");
scanf("%d",&in.x.cx);
in.h.ah=0X2B;
int86(0X21,&in,&out);
printf("\nNEW SYSTEM DATE:%d- %d- %d",out.h.dl,out.h.dh,out.x.cx);
getch();
}
Output
CURRENT
SYSTEM DATE:19- 8- 2011
ENTER
NEW DATE:
DAY:10
MONTH:11
YEAR:2009
NEW
SYSTEM DATE:10- 11- 2009
No comments:
Post a Comment