Reading single character in linux

This is a discussion on Reading single character in linux within the Linux Programming forums, part of the Platform Specific Boards category; In linux...how can my c program get a single character from a keyboard without hitting 'Enter'(newline)???...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Reading single character in linux

    In linux...how can my c program get a single character from a keyboard without hitting 'Enter'(newline)???

  2. #2
    Registered User rohit's Avatar
    Join Date
    Feb 2002
    Posts
    69
    getchar,getche, getch functions i think can do that ...

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,333
    You have to make stdin unbuffered

    Try
    setbuf
    setvbuf

    Or looking at termios

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    197
    getch() , getche() arenīt ANSII-conform!!

    klausi
    When I close my eyes nobody can see me...

  5. #5
    Registered User PutoAmo's Avatar
    Join Date
    Mar 2002
    Posts
    72

    Non Canonical

    You have to go into noncanonical mode. default is canonical

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pseudo TTY not reading singal character
    By MrUmunhum in forum Linux Programming
    Replies: 0
    Last Post: 11-18-2008, 06:02 PM
  2. Replies: 26
    Last Post: 11-30-2007, 02:51 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. reading a character
    By Calavera in forum C Programming
    Replies: 6
    Last Post: 11-23-2004, 11:25 AM
  5. Character handling help
    By vandalay in forum C Programming
    Replies: 18
    Last Post: 03-29-2004, 04:32 PM

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