# include int main ( void ) { // // This program reads words one at a time from an input file, // and prints them. // // This program assumes that no word will ever be longer than 80 characters. // // A word is any consecutive string of characters terminated by a blank, // a new line, or other "white space" such as a TAB. // FILE *input; int status; char w[81]; int words; input = fopen ( "gettysburg.txt", "rt" ); words = 0; while ( 1 ) { status = fscanf ( input, "%s", w ); if ( status <= 0 ) { break; } words = words + 1; printf ( "%i: \"%s\"\n", words, w ); } fclose ( input ); return 0; }