ccplusplus.com
Learn C, C++ Concepts
Friday, January 6, 2012
displaying file content c
/******************************************************************* * File : display-file-content.c * Author : Saurabh Gupta * Description : displaying file content c * Date : PM 09:50 06 January 2012 * Source : http://www.ccplusplus.com/p/c.html *******************************************************************/ #include
void main() { FILE *fopen(), *fp; int c ; fp = fopen( "ccplusplus.com", "r" ); c = getc( fp ) ; while ( c != EOF ) { putchar( c ); c = getc ( fp ); } fclose( fp ); } /* * OUTPUT * [sgupta@rhel6x64 file-handling]$ gcc -o display-file-conten display-file-content.c [sgupta@rhel6x64 file-handling]$ ./display-file-conten XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX www.ccplusplus.com XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [sgupta@rhel6x64 file-handling]$ */
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment