The function getc () in C
The function int getc (FILE * stream) in C Library standard takes the next character (an unsigned char) from the given Stream and increases the position indicator for that Stream.
The function int getc (FILE * stream) in C Library standard takes the next character (an unsigned char) from the given Stream and increases the position indicator for that Stream.
Declare getc () function in C
Below is the declaration for the getc () function in C:
int getc ( FILE * stream )
Parameters
stream - This is the pointer to a FILE object that identifies the Stream on which the operation is performed.
Returns the value
This function returns the character read as an unsigned char that is cast to an int or EOF or an error.
For example
The following program C illustrates the usage of the getc () function in C:
#include int main () { char c ; printf ( "Nhap ky tu: " ); c = getc ( stdin ); printf ( "Hien thi ky tu vua nhap: " ); putc ( c , stdout ); return ( 0 ); } Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Function fputs () in C
Next lesson: getchar () function in C
Discover more
run program C parameter in C Function ftell () in CShare by
Micah Soto
Update 25 May 2019
You should read it
- Function vfprintf () in C
- The function setvbuf () in C
- Function putc () in C
- The sprintf () function in C
- Remove () function in C
- The Quiet Details That Make a Sports Betting Platform Feel Reliable
- Instructions on creating toy set images with ChatGPT AI
- How are AI agents changing the journalism industry?
- setjmp.h in C
- signal.h in C
- Function raise () in C