GoHacking.com: Ethical Hacking and Cyber Security
Home » C PROGRAMMING

C Program to Set/Change the Current System Date

Submitted by on Wednesday, 16 January 20085 Comments

This program can be used to set the system date or to change the current system date.

 
 
 
#include <stdio.h>
#include <process.h>
#include <dos.h>

int main(void)
{
struct date reset;
struct date save_date;
getdate(&save_date);
printf(“Original date:\n”);
system(“date”);
reset.da_year = 2001;
reset.da_day = 1;
reset.da_mon = 1;
setdate(&reset);
printf(“Date after setting:\n”);
system(“date”);
setdate(&save_date);
printf(“Back to original date:\n”);
system(“date”);
return 0;
}



By using/following this site you agree to our Legal Disclaimer

5 Comments »

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.