readlmain.c
来自「C语言编写的关于文件的基本 操作的程序源代码」· C语言 代码 · 共 30 行
C
30 行
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include "readline_.h"
int main(void)
{
char buf[80];
char filename[16];
int fd = -1;
int count = 1;
int ret;
puts("Get Start :");
scanf("%s",filename);
fd = open(filename,O_RDONLY);
if(fd != -1){
ret = readline(fd,buf,sizeof(buf));
while(ret >= 0){
printf("%d : %s\n",count,buf);
ret = readline(fd,buf,sizeof(buf));
printf("ret : %d\n",ret);
count++;
}
printf("%d : %s\n",count,buf);
return 1;
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?