Thread: Getting input without waiting for keypress

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    4

    Getting input without waiting for keypress

    Hey there everyone, can any of you guys tell me a way to read input from the keyboard without waiting for the keypress? What I mean is, I don't want the program to wait around all day for the user to hit a key. The program should continue doing other stuff, but when a key is pressed the program should detect it. Ideas, anyone?

    Have a productive day, guys.

  2. #2
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    Your program could be doing things within a loop. One of the elements of the loop is checking for a key press. What does your programme do? OS?
    Demonographic rhinology is not the only possible outcome, but why take the chance

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    4
    Something more like a task scheduler maybe. It has several little subprograms, and it's supposed to switch between the tasks. How would I check for the keypress inside the loop without waiting for it?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    4
    Aw, rats! I was hoping for a platform-inspecific way of doing it. Drat...
    Thanks anyway, guys.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Input class project (again)
    By Elysia in forum C++ Programming
    Replies: 41
    Last Post: 02-13-2009, 10:52 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. Getting input without waiting for keypress
    By Anon48 in forum C Programming
    Replies: 2
    Last Post: 04-08-2005, 02:18 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM