home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!nic.umass.edu!m2c!jjmhome!alden!alden.UUCP
- From: sgr@alden.UUCP (Stan Ryckman)
- Newsgroups: comp.lang.c
- Subject: Re: date format
- Message-ID: <653@alden.UUCP>
- Date: 4 Jan 93 18:10:40 GMT
- References: <92364.133407EPA100@psuvm.psu.edu>
- Sender: usenet@alden.UUCP
- Organization: Alden Electronics, Westboro, MA
- Lines: 28
-
- In article <92364.133407EPA100@psuvm.psu.edu> EPA100@psuvm.psu.edu writes:
- >what I am attempting is as follows
- >
- >struct dat{
- > int dayr; /* struct to get the date from the system through dos.h*/
- > char damo;
- > char dada;
- > } da
- >
- >getdate(&da);
- >printf("%i\n", da.dayr);
- >printf("%s\n", da.damo);
- >etc...
- >I am able to get the year 1992, but when I attempt to print the month and day I
- >get the Borland copyright info printing on the screen.
-
- Your printf is at least part of the problem. You are using "%s" with
- a character. Use
- printf("%d\n", da.dayr);
- printf("%d\n", (int) da.damo);
-
- (Here I'm presuming that they store a 1-byte binary integer value in the
- character.)
-
- Stan.
- --
- X-Obligatory-.sig
- Stan Ryckman sgr@alden.UUCP
-