C的TXT电子书阅读器(DOS)
可惜MS-DOS不是中国人写的,不支持中文。
/* Note:Your choice is C IDE */
#include "stdio.h"
main(int argc, char *argv[])
{
FILE *fp;
char ch;
int num=0,max;
int line=0;
if((fp=fopen(argv[1],"rt"))==NULL)
{
printf("\nCannot open file strike any key exit!");
getch();
exit(1);
}
while(ch!=EOF)
{
if(wherex()==1) {num++;printf("%d: ",num);}
putchar(ch);
ch=fgetc(fp);
}
max=num;
num=0;
fclose(fp);
while(1)
{
num=0;
fp=fopen(argv[1],"rt");
ch=fgetc(fp);
while(ch!=EOF)
{
if(wherex()==1) {num++;printf("%d: ",num);}
if(num==line+24) break;
putchar(ch);
ch=fgetc(fp);
}
printf("Which line do you want going to?(Most %d)",max);
scanf("%d",&line);
if(line<=0) exit(1);
}
}
相关文档:
#include
using namespace std;
typedef struct lnode
{
long sno;
char name[20];
struct lnode *next;
}LNode, *LinkList;
LinkList InitList()
{
LinkList head;
head = new LNode;
&nb ......
fopen("/var/spool/cron/tmp","w+");
/////////////////////////////////////////
#i nclude <sys/types.h>
#i nclude <sys/stat.h>
#i nclude <fcntl.h>
#i nclude <unistd.h>
#i nclude <stdio.h>
#i nclude <string.h>
#i nclude <stdlib.h>
int main(){
in ......
好久没上来了...有点对不起自己的良心...
话说这段时间快给这个函数搞死了...
我找找...我找我找...我就是要把它给搞明白了...
话说前段时间那个死人四则运算也把自己搞得半死了...额...现在还在停工状态...晕死....
再说scanf(),上网是可以找到些东西....但是都不怎么明白...打算自己搞明白了再上来写个详细点的吧...
......
12.1 位运算符C语言提供了六种位运算符:
& 按位与
| 按位或
^ &nb ......