Program to use putc() and getc() functions
#include<stdio.h>
main()
{
FILE *f1;
char c;
printf("Data input output");
f1=fopen("Input","w"); /*Open the file Input*/
while((c=getchar())!=EOF) /*get a character from key board*/
putc(c,f1); /*write a character to input*/
fclose(f1); /*close the file input*/
printf("\nData output\n");
f1=fopen("INPUT","r"); /*Reopen the file input*/
while((c=getc(f1))!=EOF)
printf("%c",c);
fclose(f1);
getch();
}
Comments
Post a Comment