是什么意思用C来写到标准输出? [英] What does it mean to write to stdout in C?

查看:113
本文介绍了是什么意思用C来写到标准输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是否写入标准输出的程序写入到一个文件?屏幕?我不明白它的意思写到标准输出。

Does a program that writes to "stdout" write to a file? the screen? I don't understand what it means to write to stdout.

推荐答案

这意味着,要打印的会议......不管这可能是主要的输出设备上输出。用户的控制台,tty的会话,文件或谁知道什么。什么该设备可以是取决于如何程序正在运行,并从那里而变化。

That means that you are printing output on the main output device for the session... whatever that may be. The user's console, a tty session, a file or who knows what. What that device may be varies depending on how the program is being run and from where.

以下命令将写到标准输出设备(标准输出)...

The following command will write to the standard output device (stdout)...

printf( "hello world\n" );

这只是另一种方式,在本质上,这样做的......

Which is just another way, in essence, of doing this...

fprintf( stdout, "hello world\n" );

在这种情况下,标准输出是一个指针,重新$ P $一个文件流psents默认输出设备为应用程序。你也可以使用

In which case stdout is a pointer to a FILE stream that represents the default output device for the application. You could also use

fprintf( stderr, "that didn't go well\n" );

在这种情况下,你会发送输出到标准错误输出设备应用程序可能,也可能不相同的标准输出 - 与标准输出标准错误是一个指向一个文件流再presenting默认输出设备的错误消息。

in which case you would be sending the output to the standard error output device for the application which may, or may not, be the same as stdout -- as with stdout, stderr is a pointer to a FILE stream representing the default output device for error messages.

这篇关于是什么意思用C来写到标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆