Anyone know why this code wouldn't print out what's in the .txt file?![]()
and the .txt file reads:Code:#include <stdio.h> #include <stdlib.h> int main( void ) { FILE *fp; if (( fp = fopen( "info.txt", "r" )) == NULL ) { printf( "Input file could not be opened\n" ); exit( 1 ); } if ( fclose( fp ) == EOF ) printf( "File couldn't be closed\n" ); return 0; }
Code:printf( "This is the info.txt file.\n" ); printf( "This is the second line of text from info.txt.\n" ); printf( "This is the third line of text from info.txt.\n" ); printf( "This is the fourth line of text from info.txt.\n" ); printf( "This is the fifth line of text from info.txt.\n" ); printf( "This is the sixth line of text from info.txt.\n" ); printf( "This is the seventh lineof text from info.txt.\n" ); This is the first line without the printf command in info.txt This is the second line without the printf command in info.txt This is the third line without the printf command in info.txt This is the fourth line without the printf command in info.txt This is the fifth line without the printf command in info.txt This is the sixth line without the printf command in info.txt This is the seventh line without the printf command in info.txt



LinkBack URL
About LinkBacks



