STDERR?它是什么?它的一般用途是什么? [英] STDERR? What is it? What are its common uses?

查看:290
本文介绍了STDERR?它是什么?它的一般用途是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对手柄STDERR的工作方式感到好奇吗?让我们简单地说一下批处理文件,以使其简单而集中?我知道许多编程语言都接受STDERR,所以我不知道用途是否可能完全不同,或者所有编程语言都有共同的功能吗?

Curious about how the handle STDERR works? Lets keep it down to say Batch Files to keep it simple and focused? I know that many programming languages accept STDERR, so I don't know if maybe uses are different across the board or maybe there is a common function for all programming languages?

如果任何人都可以提供一些您所看到的常用用法示例,或者解释为什么有人可以将其用于????情况真棒.

If anyone can provide some examples on common usage that you have seen or an explanation of why someone may utilize it for ??? situation that would be awesome.

提前谢谢!

推荐答案

通常,您将使用stderr来显示错误消息.

Usually you would use stderr for error messages.

如果在命令行上运行程序,则可以捕获其stdout和/或stderr

If you run a program on the command line, you can capture its stdout and/or stderr

例如:

myprogram.exe > stdout.txt

将捕获myprogram.exe写入stdout的所有内容并将其放置在stdout.txt中.但是,写入stderr的内容将不会放入stdout.txt中.因此,您可以捕获程序的常规输出,而无需捕获错误消息.

will capture anything written by myprogram.exe to stdout and place it in stdout.txt. However, stuff written to stderr will not be put into stdout.txt. Thus you can capture the program's regular output without capturing error messages.

这篇关于STDERR?它是什么?它的一般用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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