I have a program process composed of two functions. The first calls count_all_characters to count the total number of characters in a file. Then it calls a second function to count all the floating point numbers in a file. However, I’m having trouble clearing the IO stream from the first program before it can process the second program. The second portion keeps running into the EOF from count_all_characters(), which makes it not run at all, thus instant EOF and 0 count of floats. Here’s what I have for my flush(doesn’t seem to want to work though): Ideas?
#define FLUSH while(getchar() != '
')
char_count = count_all_characters(input, output);
FLUSH;
white_space_count = count_all_spaces(char_count, input, output);
fprintf(output,"The input file has white %d space character(s).
",white_space_count);
printf("White space count processed and recorded to log.
");