getchar function


getchar is used to read data from the keyboard ( stdin). Effectivly it is a fgetc(stdin).

The problem with this function is that the characters are buffered until RETURN is hit! This means that getchar does not see the characters until the user presses return. The non standard function getche gets around this problem and sees each character as it is pressed. I have not been able to produce the same function on Linux. The nearest I can get is by using 'curses' but it keeps clearing the screen!

Library:   stdio.h

Prototype: int getchar(void);

Syntax:    ch = getchar();

example program.


See also:


Top Master Index Keywords Functions


Martin Leslie