ttyname() - question

Norman Diamond diamond at csl.sony.co.jp
Wed Aug 30 12:44:14 AEST 1989


In article <99 at lkbpyr.UUCP> jonas at lkbpyr.UUCP (Jonas Heyman) writes:

->I was wondering why this works:
->#include <stdio.h>
->main()
->{
->	char *term;
->	char *ttyname();
->	term=ttyname();
->	printf("%d",term);
->}
->
->And why this doesnn't:
->#include <stdio.h>
->main()
->{
->	test();
->}
->test()
->{
->	char *term;
->	char *ttyname();
->	term=ttyname();
->	printf("%d",term);
->}

Looks to me like they should both fail.  You CAN print the decimal
value of a pointer (using "%d") but it isn't what you're asking for.
Try "%s" or maybe even "%s\n".

-- 
Norman Diamond, Sony Corporation (diamond at ws.sony.junet)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.



More information about the Comp.lang.c mailing list