【发布时间】:2011-04-21 10:35:15
【问题描述】:
对于我的操作系统类,我应该只使用系统调用(没有 printf)来实现 Linux 的 cat
阅读this reference 我发现它被用于打印到文件。我想我应该操纵 ofstream。
示例中出现:ofstream outfile ("new.txt",ofstream::binary);
如何让它写入屏幕?
编辑:我意识到这个 write() 是 iostream 库的一部分,这与 int write (int fd, char *buf , int size) 系统调用相同吗?
【问题讨论】:
-
别忘了 Linux cat 是 GNU cat 并且有 11 个不可忽略的命令行选项 ;-).linux.die.net/man/1/cat
-
您已将此标记为
C,但您正在谈论并链接到C++课程。这应该是C还是C++?重新编辑 - 我不会考虑允许 iostream,因为“只有系统调用”,只有man 2 write
标签: c linux system-calls