reading a character

This is a discussion on reading a character within the C Programming forums, part of the General Programming Boards category; HI How can i read a character without pressing the enter key?...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    29

    reading a character

    HI

    How can i read a character without pressing the enter key?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Look at your keyboard?

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    29
    está armado em palhaço!
    o gajo é mesmo parvo.

    I want to do a scanf without pressing the enter key in the end of the input.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Hmmm. I wonder if this is something that might be in the FAQ? ...

    FAQ > How do I... (Level 2) > How can I get input without having the user hit [Enter]?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    Quote Originally Posted by Calavera
    está armado em palhaço!
    o gajo é mesmo parvo.

    I want to do a scanf without pressing the enter key in the end of the input.

    i think getch() is what you are looking for.
    u can put in something like
    Code:
     char a[5];
     a[0]=getch();
    and so on....
    u can try the rest i hope,by the way,i tried this in the borland 6.0 and the borland 3.0 compiler and it worked.
    so try it out

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Quote Originally Posted by Calavera
    está armado em palhaço!
    o gajo é mesmo parvo.
    Speak english ONLY. And use getch(). There are tons of info on that function, although it isn't part of ANSI C standard or POSIX standard. It's part of the MS console libraries. Include conio.h

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by PING
    i think getch() is what you are looking for.
    Quote Originally Posted by xErath
    And use getch(). There are tons of info on that function, although it isn't part of ANSI C standard or POSIX standard. It's part of the MS console libraries. Include conio.h
    You mean like the FAQ covers, as it's already been stated.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 10-07-2008, 07:19 PM
  2. Reading Character at a time from a text file
    By Giania in forum C Programming
    Replies: 8
    Last Post: 02-25-2006, 03:17 PM
  3. reading in one character at a time
    By isotope1 in forum C++ Programming
    Replies: 2
    Last Post: 01-26-2006, 12:55 PM
  4. Reading console input (character mode applications)
    By maxhavoc in forum Windows Programming
    Replies: 12
    Last Post: 11-27-2005, 04:13 AM
  5. character strings and reading in a file...
    By Unregistered in forum C Programming
    Replies: 14
    Last Post: 07-30-2002, 10:51 AM

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