getch() and getche() in MSC 4.0
Yaping Xu
yaping at eleazar.dartmouth.edu
Fri Oct 21 23:53:38 AEST 1988
[This article was written by Scott Horne, not Yaping Xu.
Direct all e-mail responses to me at jalphin at prism.clemson.edu.]
Several people have answered my question about getch() & getche() in MSC.
I didn't know that `toupper' was a macro, which it is:
# define toupper(c) ( (islower(c)) ? _toupper(c) : (c) )
which caused the problem: "toupper(getch())" would evaluate to
((islower(getch()) ? _toupper(getch()) : getch())
and islower() would be expanded, and so would _toupper() be. Thus getch()
is called at least twice.
Thanks for pointing out my stupid mistake--and please stop filling my mailbox
with responses! :-)
--Scott
More information about the Comp.lang.c
mailing list