question about ctime(3) and time(2) - (nf)

johnl at haddock.UUCP johnl at haddock.UUCP
Wed Apr 4 14:41:11 AEST 1984


#R:sri-arpa:-44200:haddock:16800010:000:346
haddock!johnl    Apr  3 11:10:00 1984

In this code:

	main()
	{
		  long i;
		  char *t;

		  t = ctime(time(&i));
	}

the problem is simple.  The argument to ctime() is a pointer to a long,
not the long itself.  This will work on all of the Unix systems I know:

		  time(&i);
		  t = ctime(&i);

More careful reading of your manual would have revealed this.

John Levine, ima!johnl



More information about the Comp.unix.wizards mailing list