Xref: utzoo comp.lang.c:21315 comp.lang.c++:4504 Path: utzoo!utgpu!watmath!att!dptg!rutgers!cs.utexas.edu!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.co.jp (Norman Diamond) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: ttyname() - question Message-ID: <10760@riks.csl.sony.co.jp> Date: 30 Aug 89 02:44:14 GMT References: <99@lkbpyr.UUCP> Reply-To: diamond@riks. (Norman Diamond) Followup-To: comp.lang.c Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 35 In article <99@lkbpyr.UUCP> jonas@lkbpyr.UUCP (Jonas Heyman) writes: ->I was wondering why this works: ->#include ->main() ->{ -> char *term; -> char *ttyname(); -> term=ttyname(); -> printf("%d",term); ->} -> ->And why this doesnn't: ->#include ->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@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.