Borland C++ reference

getchar

raw OCR

Gets character from stdin.

Defined in header <stdio.h>

Syntax

#include <stdio.h>
int getchar(void);

Portability

DOSUNIXWindowsANSI CC++ only
■■■

Remarks

getchar is a macro that returns the next character on the named input stream stdin. It is defined to be getcistdin).

Return value

On success, getchar returns the character read, after converting it to an int without sign extension. On end-of-file or error, it returns EOF.

See also

Example

#include <stdio.h>

int main(void)
{
   int c;

   /* Note that getchar reads from stdin and  is line buffered; */
   /* this means it will not return until you press  <ENTER> */
   while ((c = getchar 0)  1= '\n')
      printf("%c", c);
return

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.