question about ctime(3) and time(2) in unix v6

gds at Mit-Csr.ARPA gds at Mit-Csr.ARPA
Fri Mar 30 09:34:00 AEST 1984


time(2) in unix v6 says it takes as argument a long, and returns suitable
information for ctime(3) to return a character pointer.  However, I'm
getting strange results when I try to do a couple of things.

executing
main()
{
          long i;
          char *t;

          t = ctime(time(&i));
}
results in a core dump.  The sources to date(1) show time(2) as taking
int [2] rather than long.  So when I tried the following, I got a bus
error core dump.

main()
{
          int i[2];
          char *t;

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

when substituting t[80] for *t, it did not compile, claiming that the
line which the assignment to t is on needed an lvalue (i presume it is
the "t" that doesn't have one).

Am I doing something wrong, or is unix?  Should I be loading some
special library?
-------



More information about the Comp.unix.wizards mailing list