0% found this document useful (0 votes)
45 views2 pages

File Reading in C with Char Buffer

This C program opens a text file called "sss7.txt" and reads the contents of that file character by character. It prints each character to the screen until it reaches the end of the file (EOF), then closes the file. The program uses standard input/output functions like fopen, getc, putchar, and fclose to read a file one character at a time and display its contents.

Uploaded by

Kumari Mugilan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views2 pages

File Reading in C with Char Buffer

This C program opens a text file called "sss7.txt" and reads the contents of that file character by character. It prints each character to the screen until it reaches the end of the file (EOF), then closes the file. The program uses standard input/output functions like fopen, getc, putchar, and fclose to read a file one character at a time and display its contents.

Uploaded by

Kumari Mugilan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include<stdio.

h>

#include<stdlib.h>

main(){

FILE *fp;

char c;

char buff[255];

int b=0,i;

// fp = fopen(__FILE__,"r");

fp = fopen("sss7.txt","r");

do{

c= getc(fp);

putchar(c);

while(c!=EOF);

fclose(fp);
}

You might also like