Anthony Miller
Anthony Miller

Reputation: 15909

STDERR? What is it? What are its common uses?

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!

Upvotes: 5

Views: 11832

Answers (2)

jpm
jpm

Reputation: 3155

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).

Upvotes: 0

Jack Edmonds
Jack Edmonds

Reputation: 33171

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:

myprogram.exe > 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.

Upvotes: 5

Related Questions