help to new C programmer with time.h

EVENSONG swood at vela.acs.oakland.edu
Fri Mar 1 16:23:44 AEST 1991


I am delving into learning C programming this week, and I was in the process
of converting one of my old basic programs over to C, and got to noting that
instead of input day and month directly, I could take it directly off of the
system clock.  But, I can not seem to get it to work.  Here is one of 
multiple combinations that I tried:

---------------------cut here------------------
#include "stdio.h"
#include "time.h"

main()
{
  struct tm tt;
  time_t lt;
  int d, m;

  time(&lt);
  d = tt.tm_mday;
  m = tt.tm_mon;

  printf("Day %d Month %d\n", d, m);
}
----------------------------cut here-------------------

swood
-- 
 ---- Insert favorite .signature here ----	| swood at argo.acs.oakland.edu
						| swood at vela.acs.oakland.edu
Bitnet:		swood at Oakland			| swood at unix.secs.oakland.edu
  UUCP:		...!uunet!umich!{vela, argo, unix, nucleus}!swood



More information about the Comp.lang.c mailing list