Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Detecting control codes

WeirdofreakWeirdofreak Posts: 439Member
Assuming that the control codes for characters such as the cursor keys and F* (decimal 27 followed by 1-4 other numbers, or none for escape) are standard across POSIX-compliant systems, how would I detect one? I can do a test for 27 and then get more of them until I find a code I recognise, but then if I wanted Escape to be recognised I wouldn't be able to tell (ESC)[A from uparrow. I also wouldn't be able to easily tell when to assume that the code is to be printed.

This is more hypothetical than anything else, because I don't really need anything except the cursors and home/end/insert/delete, but I might want some others in the future.
Sign In or Register to comment.