Mail Archives: djgpp/1997/01/17/00:51:45
Master of Zoul wrote:
>
> Get the system year.
>
> I am new to C, so I don't understand the time.h file... :<
>
> Plz help me out (do not tell me to look at the time.h file, as I
> mentioned before)
You don't want to look at the header file - it's only for experienced
folks. :) Just look in the libc documentation. For example, type the
following words of wisdom from your DOS prompt (this requires that you
have installed 'v2gnu/txi390b.zip'):
info libc funct time
You'll be treated to a list of all the time-related functions in DJGPP.
For a brief example of getting the year, look at the following (tested)
program:
#include <stdio.h>
#include <dos.h>
int main( void )
{
struct date d;
getdate( &d );
printf( "The year is %d.\n", d.da_year );
return 0;
}
That's it! The rest of the program is left as an exercise for the
reader. ;)
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| God's final message to His Creation: | http://www.cs.com/fighteer |
| "We apologize for the inconvenience."| Fight against proprietary |
| - Douglas Adams | software - support the FSF!|
---------------------------------------------------------------------
- Raw text -