Thread: Char input

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    5

    Question Char input

    How can I get a charactor from the commandline without waiting for a carriage return. gets/getchar/cin/scanf, takes in a char, but the user has to hit return before it will continue. I want to take in chars one by one, with no return. Any ideas?
    Thanks

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    11

    Arrow I have the answer

    I guarantee this will work for you.

    #include <conio.h>

    void main()
    {
    getch();
    }



    This waits for any keypress, and does not require a Carriage Return after the input.

    Any problems, mail me.

    [email protected]
    With my naked eye I saw all the falling rain, coming down on me...

  3. #3
    Registered User Natase's Avatar
    Join Date
    Aug 2001
    Posts
    123
    to actually capture the character type "variable = getch()"

    eg

    char c;
    c=getch();

    puts the character the user pressed into 'c'

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    5
    Thanks, it works great.
    Is there a Wide character equivalent to this function for UNICODE

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. How do i un-SHA1 hash something..
    By willc0de4food in forum C Programming
    Replies: 4
    Last Post: 09-14-2005, 05:59 AM
  4. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM