Export (0) Print
Expand All

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.

int main()
{
   Stream^ inputStream = Console::OpenStandardInput();
   array<Byte>^bytes = gcnew array<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 );
   array<Char>^chars = Encoding::UTF7->GetChars( bytes, 0, outputLength );
   Console::WriteLine( "Decoded string:" );
   Console::WriteLine( gcnew 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

Community Additions

ADD
Show:
© 2014 Microsoft