Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Console::OpenStandardError Method ()

 

Acquires the standard error stream.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
[HostProtectionAttribute(SecurityAction::LinkDemand, UI = true)]
static Stream^ OpenStandardError()

Return Value

Type: System.IO::Stream^

The standard error stream.

This method can be used to reacquire the standard error stream after it has been changed by the SetError method.

The following example is a simple text file viewer that displays the contents of one or more text files to the console. If there are no command line arguments, or if any files passed as command line arguments do not exist, the example calls the SetError method to redirect error information to a file, calls the OpenStandardError method in the process of reacquiring the standard error stream, and indicates that error information was written to a file.

No code example is currently available or this language may not be supported.

Note that the StreamWriter::AutoFlush property is set to true before reacquiring the error stream. This ensures that output will be sent to the console immediately rather than buffered.

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft