#include #define MAX_LINE 1000 int main( int argc, char *argv[] ) { FILE *fp; char line[MAX_LINE]; #ifdef DEBUG_MODE printf( "Attempting to open file %s\n", argv[1] ); #endif fp = fopen( argv[1], "r" ); if ( fp == NULL ) { fprintf( stderr, "ERROR: Could not open %s\n", argv[1] ); perror( "Could not open file" ); return 1; } else { int i = 1; while ( fgets( line, MAX_LINE, fp ) != NULL ) { printf( "%6d| %s", i, line ); i++; } fclose( fp ); } return 0; }