Hey guys,
I'm having a slight problem with a module here.
Here's the code samples.
Code:case '5': fflush(stdin); show_Rec(); clrscr(); menu(); break;The problem here is that after the show_Rec function has been executed and the menu has been called, the last record from the file is still displaying on the screen at the bottom. I have tried clrscr(); but it doesnt work.Code:void show_Rec(void) { char buf[BUFSIZ] ; int i; if ((rslpf = fopen("C:\\rslpf.txt", "r")) == NULL) { printf("\a! Error: Cannot open file"); exit(EXIT_FAILURE); } i=0; clrscr(); while (fgets(buf, sizeof(buf), rslpf) != NULL) { printf("%s", buf); ++i; if ( i > 6 ) /* (0-6) five entries in record followed by two newline characters*/ { /* press enter to skip line and display next record */ getchar(); /* make i zero to start over */ i=0; } }fclose(rslpf); }
I would greatly appreciate any ideas you may have.