Header File
dos.h
Category
Time and Date Routines
Prototype
void getdate(struct date *datep);
void setdate(struct date *datep);
Description
Gets and sets system date.
getdate fills in the date structure (pointed to by datep) with the system's current date.
setdate sets the system date (month, day, and year) to that in the date structure pointed to by datep. Note that a request to set a date might fail if you do not have the privileges required by the operating system.
The date structure is defined as follows:
struct date{
int da_year; /* current year */
char da_day; /* day of the month */
char da_mon; /* month (1 = Jan) */
};
Return Value
getdate and setdate do not return a value.
Example
#include <dos.h> #include <stdio.h> int main(void) { struct date d; getdate(&d); printf("The current year is: %d\n", d.da_year); printf("The current day is: %d\n", d.da_day); printf("The current month is: %d\n", d.da_mon); return 0; }
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|