Borland C++ reference

fgetchar

raw OCR

Gets character from stdin.

Defined in header <stdio.h>

Syntax

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

Portability

DOSUNIXWindowsANSI CC++ only
■■■

Remarks

fgetchar returns the next character from stdin. It is defined as igetcistdin).

Return value

On success, fgetchar 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)
{
   char ch;

   /* prompt the user for input */
   printf("Enter a character followed by <Enter>:  ");

   /* read the character from stdin */
   ch = fgetchar0 ;
   /* display what was read */
   printf("The character read is: '%c'\n", ch);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.