From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Getting the year straight!! Date: Thu, 16 Jan 1997 18:51:12 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 43 Message-ID: <32DEE920.6120@cs.com> References: <32DDDB36 DOT 2F00 AT pulsar DOT net> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp106.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 #include 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!| ---------------------------------------------------------------------