Hi,
Post by Lew PitcherPost by Lew PitcherTypically, if your application is designed to require knowledge of
"keypress",
Post by Lew Pitcherthen the application is not designed correctly for Linux.
Now, listen. I'm really fed up with this kind of arrogant comments by
all-knowing Linux guys (I know there are others too, so I won't
generalize).
While I agree with you that this kind of answer is agorrant and
unsuitable, I have to agree that you need to state your problem
clearer. "Keypress" has several abstractions, and dependent on what
*exactly* you want to do, some of them might be more apropriate than
others.
Post by Lew PitcherWhat you're saying is that an application that uses keypresses to let
a user play a melody on his keyboard (to give an example) is not
something that should be done on Linux.
It should be done on Linux, but it should be done in a different
way than "conio.h" and doing that from the shell. A keypress for a console
applications has other semantics than a keypress for a graphical end
user application. Your users won't be happy if they would have to hold
the shell window open and active to play a melody. They would be happy
if there would be a graphical keyboard on the screen that, when activated
by the window manager (say, KDE) plays a melody when the keys are pressed.
In this case, the X11 system (or its various helper libraries) seem to
be much more suitable to solve your problem than to go for the console.
Post by Lew PitcherAnd by the way: this is what someone else posted as a reply to my
"The equivalent to conio.h in unixy systems is the curses library - in
particular the ncurses implementation is popular on linux (this is
what
programs like the bash shell use). You want getch() in no-delay
mode."
So the bash shell is "not designed correctly for Linux" then (your
quote)?
"The bash shell is not designed correctly to play a melody." Yes, I'll
sign that. (-;
Post by Lew PitcherI'm really fed up with this kind of arrogancy, sorry (even if there
might be truth in some of your remarks, I'm not a black-and-white type
of guy).
Me, too. (-;
But then, it's better to give backgrounds about the problem you want
to solve than to state the problem "I want a keypress". There is no
single solution that is suitable for all problems, as there is no
concept of "a keypress". There is a concept of "getting a single
character unbuffered from an input stream", which has one concrete
realisation in the console connected to the keyboard, and "get an
X11 keypress event", which is suitable for graphical applications.
Post by Lew PitcherNow I'm not following you any longer: a few lines above you say that
it IS possible using the mentioned calls and/or ncurses API...
Yes, but that's maybe not want you want/need.
Post by Lew PitcherOK. Granted in general, but not for the keypress issue.
Yes, especially for this issue, I afraid. (-;
Post by Lew PitcherReally, I can take lots of advice, and I generally like it if people
tell me things to be careful with (that's why I visit newsgroups,
apart from helping out others), but your reply is plain arrogance.
Yup, no question. /-:
So long,
Thomas