Reputation: 1003
My program will open a file and print the contents in the terminal. As the file is large, the terminal goes two or more page. I'll have to slide up to the first line of the file to read from the beginning. Is it possible using C program?
void hfile()
{
printf("\033[2J");
printf("\033[0;0H");
FILE *ffp;
char c;
ffp=fopen("help.txt","r");
while((c=getc(ffp))!=EOF)
printf("%c",c);
}
Upvotes: 0
Views: 825
Reputation: 4205
Not via stdlib. You will have to use some third-party library like ncurses.
Upvotes: 1