#include <stdio.h>
#include "csapp.h"
int main(int argc, char* argv[]) {
int n;
rio_t rio;
char buf[MAXLINE];
int fd;
if (fd = Open(argv[1], O_RDONLY, 0) != -1) {
while ((n = Rio_readn(fd, buf, MAXBUF)) != 0)
Rio_writen(STDOUT_FILENO, buf, n);
exit(0);
}
Rio_readinitb(&rio, STDIN_FILENO);
while ((n = Rio_readlineb(&rio, buf, MAXLINE)) != 0)
Rio_writen(STDOUT_FILENO, buf, n);
return 0;
}
深入理解计算机系统 CSAPP 家庭作业10.10
于 2024-07-19 17:08:22 首次发布