Pregunta

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);

}
¿Fue útil?

Solución

Not via stdlib. You will have to use some third-party library like ncurses.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top