#include #include #include void main(int argc,char *argv[]) { FILE *viewfile; char buffer[81]; //storage int x = 0; char c; if(argc<2) { puts("Missing filename!"); puts("Here is the format:"); puts("VIEW filename"); exit(1); } viewfile = fopen(argv[1],"r"); if(!viewfile) { printf("Error opening \"%s\"\n",argv[1]); exit(1); } while(fgets(buffer,80,viewfile)) { printf("%s",buffer); x++; if(!(x%24)) { printf("Press Enter:"); while(!kbhit()) ; c = getch(); if(c=='\x1b') exit(0); putchar('\n'); } } }