RAD Studio
ContentsIndex
PreviousUpNext
_fgetchar, _fgetwchar

Header File 

stdio.h  

Category 

Console I/O Routines 

Prototype 

int _fgetchar(void); 

wint_t _fgetwchar(void); 

Description 

Reads a character from stdin. 

_fgetchar returns the next character from stdin. It is defined as fgetc(stdin).

Note: For Win32 GUI applications, stdin must be redirected.
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. 

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 = fgetchar();
   /* display what was read */
   printf("The character read is: '%c'\n", ch);
   return 0;
}

Portability

 
POSIX 
Win32 
ANSI C 
ANSI C++ 
_fgetchar 
 
 
 
_fgetwchar 
 
 
 
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!