Thursday, 14 June 2012

/*
Write a C program to display the contents of a file. 
*/
# include<stdio.h>
main( )
{
FILE *fp ;
char ch ;

fp = fopen ( "PR1.C", "r" ) ;

while ( 1 )
{
ch = fgetc ( fp ) ;

if ( ch == EOF )
break ;

printf ( "%c", ch ) ;
}

fclose ( fp ) ;
}

No comments:

Post a Comment