我怎样才能使系统调用write()输出到屏幕上? [英] How can I make the system call write() print to the screen?
本文介绍了我怎样才能使系统调用write()输出到屏幕上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有关我的操作系统级我应该只使用系统调用来实现的Linux的猫(没有的printf)
For my OS class I'm supposed to implement Linux's cat using only system calls (no printf)
这个参考我发现它被用来打印到文件。我想我应该处理的ofstream。
Reading this reference I found it being used to print to a file. I guess I should manipulate ofstream.
在这个例子中显示为:的ofstream outfile中(new.txt的ofstream ::二进制);
In the example appears: ofstream outfile ("new.txt",ofstream::binary);
如何才能把它写在屏幕上?
How can I make it write to the screen?
编辑:我意识到这一点的write()是iostream库的一部分,这是一样的INT写入(INT FD,字符* buf中,诠释大小)系统调用
推荐答案
写入标准输出或标准错误(1和2分别)的文件描述符。
Write to the file descriptor for standard output or standard error (1 and 2 respectively).
这篇关于我怎样才能使系统调用write()输出到屏幕上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文