-1

I Want to get keystate for some key like shift. If I press "a" with shift to write "A" then by g++ program on linux how can I ensure that shift is also pressed while I press key "a".

Thanks in advance.

user1531302
  • 21
  • 1
  • 1
  • 2

1 Answers1

0

See the answer for this question: What is Equivalent to getch() & getche() in Linux?

It will give you the correct keycodes, i.e. 'a' if you press 'a' with shift depressed, 'A' if you press it with shift pressed, etc. Getting the state of the shift key alone is a different matter though, I'm not sure if there's an easy way to do that.

Community
  • 1
  • 1
Michael
  • 57,169
  • 9
  • 80
  • 125