is there a function like getch in windows for linux - Programmers Heaven

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.

is there a function like getch in windows for linux

i m looking to get input on character basis without enter. so is there any function which can help me taking input directly from the keyboard as and whn any key get pressed.

Comments

  • IDKIDK Posts: 1,784Member
    : i m looking to get input on character basis without enter. so is there any function which can help me taking input directly from the keyboard as and whn any key get pressed.
    :

    Yes, you'll need to modify the terminal though...

    Try google.
  • The.ShaileshThe.Shailesh Posts: 19Member
    : i tried google but didnt got much help can u provide me some more detail regaring this here i m using debian linux.
  • IDKIDK Posts: 1,784Member
    : : i tried google but didnt got much help can u provide me some more detail regaring this here i m using debian linux.
    :

    I don't remember how found it, and I can't seem to find it now either, so I just recomend searching for whatever you can think of...
  • shrinivasrathishrinivasrathi Posts: 12Member
    : i m looking to get input on character basis without enter. so is there any function which can help me taking input directly from the keyboard as and whn any key get pressed.
    :


    [b]Its very simple dude. Use getchar() function available in stdio.h lib.[/b]
    -------------------------------------------------
    Ask questions , send your answers, share your views, write anything about C programming @ http://cprogramming4u.blogspot.com/

  • IDKIDK Posts: 1,784Member
    : : i m looking to get input on character basis without enter. so is there any function which can help me taking input directly from the keyboard as and whn any key get pressed.
    : :
    :
    :
    : [b]Its very simple dude. Use getchar() function available in stdio.h lib.[/b]
    : -------------------------------------------------
    : Ask questions , send your answers, share your views, write anything about C programming @ http://cprogramming4u.blogspot.com/
    :
    :

    Not so simple...
    getchar requires an enter to work under a normal linux terminal. (It's becouse it's buffered).

    As I said, one needs to modify the terminal.
Sign In or Register to comment.