control, alt, shift in console
Does anybody know how can I found out in console whether alt, control or shift is pressed? In ncurses it is possible only for mouse events, but I need it for keyboard events. I looked into Midnight Commander sources, but it uses glib and I don't want to use X libraries in console program. There is also another way to find it out, but I don't understand it:
ioctl(0, TIOCLINUX, &modifiers);
It's only for linux, but it's better than nothing.
First argument should be descriptor (or something like that) to open file, but there is only 0. Is it stdin, stdout or something like that? I ask because it doesn't work for me (it returns -1) so I want to know how to get it working.
I would be very grateful for any way (even nonportable) to find out whether ALT, SHIFT or CONTROL is pressed.