#include int main ( int argc, char *argv[] ) { if (argc!=2){ printf("usge: %s filename", argv[0]); } FILE *file = fopen ( argv[1], "r" ); if ( file != NULL ) { int line_size = 128; char line [ 100 ]; /* or other suitable maximum line size */ while ( fgets ( line, line_size, file ) != NULL ) /* read a line */ { fputs ( line, stdout ); /* write the line */ } printf("\n"); fclose ( file ); } else { perror ( argv[1] ); /* why didn't the file open? */ } return 0; }