2 Replies - 5924 Views - Last Post: 25 June 2009 - 07:08 AM Rate Topic: -----

#1 Codergirl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 12-June 09

Spacebar in C

Posted 25 June 2009 - 06:54 AM

Hello,

I'm pretty new to programming, and have a general question. Does C allow the user to initiate a function simply by pressing a key, such as the space bar? I'm not asking for any code, but a simple key word which I can research would be great.

Thanks a bunch for your time and patience! :)

Is This A Good Question/Topic? 0
  • +

Replies To: Spacebar in C

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Spacebar in C

Posted 25 June 2009 - 07:03 AM

You can use GetAsyncKeyState()* to get pressed keys and perform action based on the outcome :)

* Providing you're working in Windows. Otherwise take a look at getch.

This post has been edited by MageUK: 25 June 2009 - 10:42 AM

Was This Post Helpful? 1
  • +
  • -

#3 Codergirl  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 12-June 09

Re: Spacebar in C

Posted 25 June 2009 - 07:08 AM

View PostMageUK, on 25 Jun, 2009 - 06:03 AM, said:

You can use GetAsyncKeyState()* to get pressed keys and perform action based on the outcome :)

* Providing you're working in Windows. Otherwise take a look at getch or getch, can't remember which is which.



Awesome!! Thank you so much :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1