H
hugo27
hugo27 July 13, 2004
hugo27 said:Is there a way in ANSI C to disable or manage
the Escape key?
hugo27 said:hugo27 July 13, 2004
I've tried capturing ascii 27
Pedro Graca said:[newbie answer]
hugo27 said:Is there a way in ANSI C to disable or manage
the Escape key?
I guess there isn't.
A microwave oven could have programs written in ANSI C.
A mobile phone could have programs written in ANSI C.
A electronic stopwatch could have programs written in ANSI C.
...
Where is the Escape key in all these things?
[newbie answer]
hugo27 said:Is there a way in ANSI C to disable or manage
the Escape key?
I guess there isn't.
A microwave oven could have programs written in ANSI C.
A mobile phone could have programs written in ANSI C.
A electronic stopwatch could have programs written in ANSI C.
...
Where is the Escape key in all these things?
hugo27 said:The teachy books and documentation [that] I've read
do not mention the Escape key
but, everytime I hit it during runtime,
my programs go bananas.
This relates to a larger issue, namely,
what is standard C good for? Of what use is it?
We have the null set: each person writes and
uses their own progams. This works to a degree,
but it makes for a small world.
What happens when you venture into the larger world
and meet up with Other People (aka, The Damm Thing)?
Suppose one writes a common menu program for an
employer and someone sonetime presses ESC,
the program crashes,
and the client wants their money back?
Are you going to tell the judge that
the complaint is Off Topic?
Is there a way in ANSI C
to disable or manage the Escape key?
I've tried capturing ascii 27 with scanf and getchar,
but it drives the program batty.
#include <stdio.h>> cat main.c
13> gcc -Wall -std=c99 -pedantic -o main main.c
> ./main
gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)> gcc --version
hugo27 July 13, 2004
In said:The teachy books and documentation I've read do not
mention the Escape key, but everytime I hit it during
runtime my programs go bananas.
This relates to a larger issue, namely, what is
standard C good for? Of what use is it?
We have the null set: each person writes and
uses their own progams. This works to a degree, but
it makes for a small world. What happens when you
venture into the larger world and meet up with
Other People (aka, The Damm Thing)?
Suppose one writes a common menu program for an
employer and someone sonetime presses ESC, the
program crashes, and the client wants their money
back? Are you going to tell the judge that the
complaint is Off Topic?
Is there a way in ANSI C to disable or manage
the Escape key? I've tried capturing ascii 27
with scanf and getchar, but it drives the program
batty.
Dan said:No, but I have yet to write a program that crashes when the user presses
the ESC key. Can you show me some sample code, so that I get a clue about
how to do it (other than by *explicitly* testing for the ESC character and
deliberately crashing the program when finding it in the user input, of
course)?
Default User said:Dan said:No, but I have yet to write a program that crashes when the user presses
the ESC key. Can you show me some sample code, so that I get a clue about
how to do it (other than by *explicitly* testing for the ESC character and
deliberately crashing the program when finding it in the user input, of
course)?
I tried what he said with my text adventure game, running under windows,
and it does crash when the input from the user is <ESC> <ENTER>. The
program reports back that [some long line of screen-draw characters] is
not a valid verb, then the system itself pops a dialog: The instruction
at "0x6f36572" referenced memory at "0x6f36572". The memory could not be
"read".
I'll have to run through in debug and see if I can figure out why it's
doing that. Probably a bug on my end. Doesn't happen under Solaris.
Mabden said:news:[email protected]...
When I was learning to program a wise man once told me that any program I
write should be able to handle the user smashing their fist (or forehead) on
the keyboard with failing.
Mabden said:When I was learning to program a wise man once told me that any program I
write should be able to handle the user smashing their fist (or forehead) on
the keyboard with failing.
IOW, any input stream should be "sanity checked" before use.
Mabden said:When I was learning to program a wise man once told me that any program I
write should be able to handle the user smashing their fist (or forehead) on
the keyboard with failing.
IOW, any input stream should be "sanity checked" before use.
Default said:Well, it's supposed to be. The problem is, I'm not sure what that ESC is
actually doing, vis-à-vis fgets(). I'll have to check and see.
I don't think that is possible in the case of using the Windows OS.
does what it does, give me some money." Windows captures ^ c and ^ z before
they even get to the user.
You need a comprehensive list of signals that *your* program can expect to
receive to do a complete sanity check, I don't think such a list exists.
I don't think that is possible in the case of using the Windows OS.
does what it does, give me some money." Windows captures ^ c and ^ z before
they even get to the user.
You need a comprehensive list of signals that *your* program can expect to
receive to do a complete sanity check, I don't think such a list exists.
I don't think that is possible in the case of using the Windows OS. I know
of no meaningful specification on Windows, Microsoft says "Here it is, it
does what it does, give me some money." Windows captures ^ c and ^ z before
they even get to the user.
What else do they capture and fiddle with?
Certainly ESC is a candidate for capturing by the OS and in particular by
Microsoft written and/or influenced programs because of Windows widespread
use of ESC to clear the most recent dialog box/whatever. I wouldn't be
surprised if some other program captured ESC and forget to restore it to the
proper state when done.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.