Passive getchar?

Discussion in 'C Programming' started by Pete Ashdown, Jun 21, 2010.

  1. Pete Ashdown

    Pete Ashdown Guest

    I want to read a keypress value inside a loop, but continue the loop if no key
    has been pressed. In other words, I don't want to stop waiting for keypress,
    but buffer it and react (differently based on the key pressed) the next time
    around. What is the best way to do this?
     
    Pete Ashdown, Jun 21, 2010
    #1
    1. Advertising

  2. Pete Ashdown

    Eric Sosman Guest

    On 6/21/2010 1:41 PM, Pete Ashdown wrote:
    > I want to read a keypress value inside a loop, but continue the loop if no key
    > has been pressed. In other words, I don't want to stop waiting for keypress,
    > but buffer it and react (differently based on the key pressed) the next time
    > around. What is the best way to do this?


    This is Question 19.1 on the comp.lang.c Frequently Asked
    Questions (FAQ) page at <http://www.c-faq.com/>.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Jun 21, 2010
    #2
    1. Advertising

  3. Pete Ashdown

    Seebs Guest

    On 2010-06-21, Pete Ashdown <> wrote:
    > I want to read a keypress value inside a loop, but continue the loop if no key
    > has been pressed. In other words, I don't want to stop waiting for keypress,
    > but buffer it and react (differently based on the key pressed) the next time
    > around. What is the best way to do this?


    To start by identifying what kind of computer you're using, and what software
    it's running, then finding a newsgroup specific to that target, since the
    answers are likely to be platform-specific.

    There is no way to do this that is plain old C; there are ways to do it
    for Unix, old Macs, Amigas, Windows, and a few other systems. There are
    some systems where you can't do it. The ways of doing it on different systems
    will only work on a few specific systems, or possibly just one, usually.

    -s
    --
    Copyright 2010, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Jun 21, 2010
    #3
  4. Pete Ashdown

    Pete Ashdown Guest

    Eric Sosman <> writes:

    >On 6/21/2010 1:41 PM, Pete Ashdown wrote:
    >> I want to read a keypress value inside a loop, but continue the loop if no key
    >> has been pressed. In other words, I don't want to stop waiting for keypress,
    >> but buffer it and react (differently based on the key pressed) the next time
    >> around. What is the best way to do this?


    > This is Question 19.1 on the comp.lang.c Frequently Asked
    >Questions (FAQ) page at <http://www.c-faq.com/>.


    Thank you!
     
    Pete Ashdown, Jun 22, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    0
    Views:
    3,831
  2. jaems

    Passive mode

    jaems, Feb 18, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    444
    Scott Roberts
    Feb 19, 2008
  3. trans.  (T. Onoma)

    Passive Arguments

    trans. (T. Onoma), Jan 16, 2005, in forum: Ruby
    Replies:
    5
    Views:
    151
    benny
    Jan 17, 2005
  4. Esteban Manchado Velázquez

    Problems with Passive Arguments and refactoring

    Esteban Manchado Velázquez, Jan 18, 2005, in forum: Ruby
    Replies:
    5
    Views:
    162
    trans. (T. Onoma)
    Jan 18, 2005
  5. Hostile17

    Net::FTP and Passive mode problems

    Hostile17, Oct 20, 2004, in forum: Perl Misc
    Replies:
    6
    Views:
    205
    Sherm Pendley
    Oct 21, 2004
Loading...

Share This Page