User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

Q&A is closed


Table of Contents


    int getc(FILE *stream);

Returns next character from (input) stream stream, or EOF on end-of-file or error.

C Sourcecode Example

 * getc example code
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
int main( void )
    FILE *stream;
    int c;
    if((stream=fopen("test.txt","r"))==NULL) {
        printf("Cannot open file.\n");
        return 1;
   while((c = getc(stream) ) != EOF) {
        printf("%c", c);
   return 0;

content of test.txt

Test example file for getc source code


  Test example file for getc source code

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdio.h/getc.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz