📄 mymore.h
字号:
#include<sys/stat.h>#include<sys/types.h>#include<sys/wait.h>#include<unistd.h>#include<stdlib.h>#include<stdio.h>#include<string.h>#include<signal.h>#include<dirent.h>void mymore(char *str){ char c[4]; long pos[100]; int i=0,n=0; FILE *file=fopen(str,"r+"); if(file==NULL) { printf("can not open file %s\n",str); return; } char buf[80]; int tag=1; for(i=0;i<23;i++) { if(!fgets(buf,80,file)) { tag=0; break; } else fputs(buf,stdout); } pos[n] = ftell(file); printf("pos[%d] : %d\n",n,pos[n]); n = n+1; printf("%s","input \'b\' to quit:"); while( fgets(c,4,stdin) && tag) { if(c[0] == 'b' || c[0] == 'B') { if(n == 1 || n == 2) { fseek(file,0,SEEK_SET); n=0; } else{ fseek(file,pos[n-3],SEEK_SET); n=n-2; } } for(i=0;i<23;i++) { if(!fgets(buf,80,file)) { tag=0; break; } else { fputs(buf,stdout); } } pos[n] = ftell(file); printf("pos[%d] : %d\n",n,pos[n]); n = n+1; c[0] = 0; printf("%s","input \'b\' to quit:"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -