eof.c

来自「北航操作系统课程设计所需源代码」· C语言 代码 · 共 23 行

C
23
字号
#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int main(){	int fd;	int ret;	char c;	if ((fd = open("/proc/stat",O_RDONLY)) < 0) {		printf("open failed\n");		exit(1);	}	while ((ret = read(fd,&c,1)) > 0)		printf("%c",c);	if (ret == 0)		printf("%c",c);	return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?