|
Rank: Advanced Member
Joined: 12/12/2009(UTC) Posts: 48 Points: 144 Location: India
|
Here is the program: Code:#include <stdio.h> /* required for file operations */ #include <conio.h> /* for clrscr */ #include <dos.h> /* for delay */
FILE *fr; /* declare the file pointer */
main()
{ int n;
int LineCount = 0; char line[80]; clrscr();
fr = fopen ("FileName.txt", "rt"); /* open the file for reading */ /* FileName.txt is the name of the file */ /* "rt" means open the file for reading text */
while(fgets(line, 80, fr) != NULL) { /* get a line, up to 80 chars from fr. done if NULL */ cout>>line; LineCount++;
if(LineCount == 24) { getChar(); //Stops the execution to wait for user input/keypress LineCount = 0; //Again start counting the number of rows for next screen } } fclose(fr); /* close the file prior to exiting the routine */ } /*of main*/ Hope it helps
|