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.OpenStandardInput Method ()

Acquires the standard input stream.

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

public static Stream OpenStandardInput ()
public static Stream OpenStandardInput ()
public static function OpenStandardInput () : Stream

Return Value

The standard input stream.

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

The following code example illustrates the use of the OpenStandardInput property.

public class Decoder {
    public static void Main() {
        Stream inputStream = Console.OpenStandardInput();
        byte[] bytes = new byte[100];
        Console.WriteLine("To decode, type or paste the UTF7 encoded string and press enter:");
        Console.WriteLine("(Example: \"M+APw-nchen ist wundervoll\")");
        int outputLength = inputStream.Read(bytes, 0, 100);
        char[] chars = Encoding.UTF7.GetChars(bytes, 0, outputLength);
        Console.WriteLine("Decoded string:");
        Console.WriteLine(new string(chars));
    }
}

public class Decoder
{
    public static void main(String[] args)
    {
        Stream inputStream = Console.OpenStandardInput();
        ubyte bytes[] = new ubyte[100];
        Console.WriteLine("To decode, type or paste the UTF7 encoded string"
            + " and press enter:");
        Console.WriteLine("(Example: \"M+APw-nchen ist wundervoll\")");
        int outputLength = inputStream.Read(bytes, 0, 100);
        char chars[] = Encoding.get_UTF7().GetChars(bytes, 0, outputLength);
        Console.WriteLine("Decoded string:");
        Console.WriteLine(new String(chars));
    } //main
} //Decoder

var inputStream : Stream = Console.OpenStandardInput();
var bytes : byte[] = new byte[100];
Console.WriteLine("To decode, type or paste the UTF7 encoded string and press enter:");
Console.WriteLine("(Example: \"M+APw-nchen ist wundervoll\")");
var outputLength : int = inputStream.Read(bytes, 0, 100);
var chars : char[] = Encoding.UTF7.GetChars(bytes, 0, outputLength);
Console.WriteLine("Decoded string:");
Console.WriteLine(chars);

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft