Getting input without waiting for keypress

This is a discussion on Getting input without waiting for keypress within the C Programming forums, part of the General Programming Boards category; Hey there everyone, can any of you guys tell me a way to read input from the keyboard without waiting ...

  1. #1
    Ink
    Ink is offline
    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
    Ink
    Ink is offline
    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
    32,834
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Ink
    Ink is offline
    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, 04:42 PM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 12:09 PM
  4. Getting input without waiting for keypress
    By Anon48 in forum C Programming
    Replies: 2
    Last Post: 04-08-2005, 03:18 AM
  5. need help with some input
    By blindleaf in forum C Programming
    Replies: 2
    Last Post: 03-16-2003, 01:50 PM

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