Home Forums C Programming difference between getchar(), getch(), and getc() Re: RE: difference between getchar(), getch(), and getc()

#3104
msaqib
Participant

Amir welcome to MYCPLUS Online Community Forums. Thanks that you like the design of the website. Here is what you asked, hopefully you will understand. If there is anyone who can ad more to it I will appriciate.
GETCHAR:
getchar is a macro defined in (stdin), getchar returns the next character on the input stream stdin.
It returns the character read, after converting it to an int without sign extension. If there is error reading the character or (and on end-of-file for getchar), it returns EOF.

GETCH:
getch gets a character from console but does not echo ( write ) to the screen. It reads a single character directly from the keyboard, without echoing
to the screen. getche reads a single character from the keyboard and echoes it to the current text window, using direct video or BIOS. Both functions return the character read from the keyboard.
Declaration:

GETC:
getc is a macro that gets one character from a stream. It returns the next character on the given input stream and increments the stream’s file pointer to point to the next character.It returns the character read, after converting it to an int without sign extension. If there is error (and on end-of-file for getc), both functions return EOF.