home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19203 < prev    next >
Encoding:
Internet Message Format  |  1993-01-04  |  1.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!nic.umass.edu!m2c!jjmhome!alden!alden.UUCP
  2. From: sgr@alden.UUCP (Stan Ryckman)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: date format
  5. Message-ID: <653@alden.UUCP>
  6. Date: 4 Jan 93 18:10:40 GMT
  7. References: <92364.133407EPA100@psuvm.psu.edu>
  8. Sender: usenet@alden.UUCP
  9. Organization: Alden Electronics, Westboro, MA
  10. Lines: 28
  11.  
  12. In article <92364.133407EPA100@psuvm.psu.edu> EPA100@psuvm.psu.edu writes:
  13. >what I am attempting is as follows
  14. >
  15. >struct dat{
  16. >  int dayr;     /* struct to get the date from the system through dos.h*/
  17. > char damo;
  18. > char dada;
  19. > } da
  20. >
  21. >getdate(&da);
  22. >printf("%i\n", da.dayr);
  23. >printf("%s\n", da.damo);
  24. >etc...
  25. >I am able to get the year 1992, but when I attempt to print the month and day I
  26. >get the Borland copyright info printing on the screen.
  27.  
  28. Your printf is at least part of the problem.  You are using "%s" with
  29. a character.  Use 
  30.     printf("%d\n", da.dayr);
  31.     printf("%d\n", (int) da.damo);
  32.  
  33. (Here I'm presuming that they store a 1-byte binary integer value in the
  34. character.)
  35.  
  36. Stan.
  37. --
  38. X-Obligatory-.sig
  39.     Stan Ryckman   sgr@alden.UUCP
  40.