标准错误?它是什么?它的常见用途有哪些?
对句柄 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.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常您会使用 stderr 来显示错误消息。
如果在命令行上运行程序,则可以捕获其 stdout 和/或 stderr
例如:
将捕获 myprogram.exe 写入 stdout 的任何内容并将其放入 stdout.txt。但是,写入 stderr 的内容不会放入 stdout.txt 中。因此,您可以捕获程序的常规输出,而无需捕获错误消息。
Usually you would use stderr for error messages.
If you run a program on the command line, you can capture its stdout and/or stderr
For example:
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 代表标准错误。顾名思义,它主要用于报告错误行为。默认情况下,在我知道的每个系统上,我都像 STDOUT 一样指向终端。然而,这些实体是单独表示的,允许用户仅将正常输出打印到终端并将错误重定向到日志(仅一个示例)。
STDERR stands for Standard Error. It, as the name suggests, primarily used for reporting erroneous behavior. By default, on every system I know of, I points to the terminal just like STDOUT. These entities are represented separately, however, allowing the user to print only normal output to the terminal and redirect errors to a log (just one example).