Thread: Accessing Keyboard via C

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    72

    Accessing Keyboard via C

    Hello,

    Today we were learning bytes and bits and the complements used in class, I am wondering if its possible to turn the caps lock on/off using the 1's complement and 2's complement? like if we can use bitwise operator and make it positie or negative? i dunno if this can be done but if someone knows of a similar program or a POC plz paste it here, thank u

    Salman

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    57

    Re: Accessing Keyboard via C

    I know, In linux we can access the keyboard using ioctl function in c.
    ioctl function used to control the devices.
    I don't know about other OS.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Standard C does not include any capability for directly accessing the keyboard (whether reading keystrokes directly or changing settings like capslock).

    The techniques to do this sort of thing depend on your operating system. sganesh has given a response that workers for linux; other operating systems will require something different.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    66
    Refer the link , hope that'll be useful
    http://www.w00w00.org/files/articles/conioctls.txt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting keyboard and mouse in linux
    By sameer.nalwade in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 04:24 AM
  2. Keyboard port using other that a keyboard
    By antoinelac in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2008, 02:46 PM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM
  5. : Difference between message queue and keyboard buffer...
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 02-21-2002, 03:47 PM