Enter Key

This is a discussion on Enter Key within the Linux Programming forums, part of the Platform Specific Boards category; how can i detect that an"Enter" key has been pressed.I want to continue the program after confirming that the pressed ...

  1. #1
    Lord CyKll
    Guest

    Question Enter Key

    how can i detect that an"Enter" key has been pressed.I want to continue the program after confirming that the pressed key is an Enter key.I am using GCC!

  2. #2
    Dev
    Dev is offline
    Registered User Dev's Avatar
    Join Date
    Mar 2003
    Posts
    59
    What if user presses some other key then Enter.

    Say user presses 'A' then 'a' will appear on user screen. That sometimes looks ugly.

    Is there any way to hide the characters that are entered through keyboard. So that they won't be displayed on user screen.

  3. #3
    Dev
    Dev is offline
    Registered User Dev's Avatar
    Join Date
    Mar 2003
    Posts
    59
    Look I know its stupidity that user types in the things and characters are not echoed to the screen.

    But I am talking in reference to current problem.

    That only pressing enter key will exit or continue.

    So if we use getchar() function in a continuous loop until '\n' is encountered then still if user presses other keys the program stays at that point only with all characters typed by users seen on the screen So I am saying this looks ugly (It's not a bogus claim) Think about it.

  4. #4
    Dev
    Dev is offline
    Registered User Dev's Avatar
    Join Date
    Mar 2003
    Posts
    59
    I am just asking it for knowldge if it can be done or not. And if yes then how.

    I also know that if you will give user message "Press Enter to Continue " then he will press Enter only not other keys.

    But say that you want to DETECT that ONLY Enter key is pressed then what ?

    The purpose of this message board is to share knowledge and gain knowledge and not to say anybody that your point is pointless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function to check memory left from malloc and free?
    By Lechx in forum C Programming
    Replies: 4
    Last Post: 04-24-2006, 06:45 AM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Dialog Edit Control and Enter Key
    By Quantrizi in forum Windows Programming
    Replies: 2
    Last Post: 04-14-2004, 08:59 AM
  4. Need to capture the enter key
    By tyouk in forum Windows Programming
    Replies: 7
    Last Post: 11-08-2003, 06:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21