C examples for stdio.h:FILE
data type
<cstdio> <stdio.h>
Object type that identifies a stream.
This example reads the content of a text file called main.cpp and sends it to the standard output stream.
#include <stdio.h> int main()/*from w w w .j a v a 2 s .c o m*/ { FILE * pFile; char buffer [100]; pFile = fopen ("main.cpp" , "r"); if (pFile == NULL) { perror ("Error opening file"); return -1; } while ( ! feof (pFile) ){ if ( fgets (buffer , 100 , pFile) == NULL ) break; fputs (buffer , stdout); } fclose (pFile); return 0; }