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);
}
}
相关文档:
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 ......
clock()返回clock_t类型;
在time.h头文件中,定义了 typedef long clock_t
clock()是用来计算两个时间点之间的时间间隔。如下程序:
#include <stdio.h>
int main()
{
int i = 0;
clock_t start_time, end_time;
start_time = clock(); //开始计时, start_time = 0
while( ......
好久没上来了...有点对不起自己的良心...
话说这段时间快给这个函数搞死了...
我找找...我找我找...我就是要把它给搞明白了...
话说前段时间那个死人四则运算也把自己搞得半死了...额...现在还在停工状态...晕死....
再说scanf(),上网是可以找到些东西....但是都不怎么明白...打算自己搞明白了再上来写个详细点的吧...
......
12.1 位运算符C语言提供了六种位运算符:
& 按位与
| 按位或
^ &nb ......
首先确保系统已经安装了gcc/g++
1> Anjuta
打开终端:
命令:sudo apt-get install anjuta
(不能安装的需要添加安装源
添加源:点击主菜单上的“系统”》“系统管理”》“软件源”,输入密码后,在出现的对话框中点“第三方软件”,
“deb http://anjuta.org.sixxs. ......