Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Acquires the standard input stream.
OpenStandardInput() |
Acquires the standard input stream. |
OpenStandardInput(Int32) |
Acquires the standard input stream, which is set to a specified buffer size. |
Acquires the standard input stream.
public:
static System::IO::Stream ^ OpenStandardInput();
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.IO.Stream OpenStandardInput();
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput();
public static System.IO.Stream OpenStandardInput();
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member OpenStandardInput : unit -> System.IO.Stream
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member OpenStandardInput : unit -> System.IO.Stream
static member OpenStandardInput : unit -> System.IO.Stream
Public Shared Function OpenStandardInput () As Stream
The standard input stream.
The following example illustrates the use of the OpenStandardInput
method.
using System;
using System.Text;
using System.IO;
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));
}
}
open System
open System.Text
let inputStream = Console.OpenStandardInput()
let bytes = Array.zeroCreate<byte> 100
Console.WriteLine "To decode, type or paste the UTF7 encoded string and press enter:"
Console.WriteLine "(Example: \"M+APw-nchen ist wundervoll\")"
let outputLength = inputStream.Read(bytes, 0, 100)
let chars = Encoding.UTF7.GetChars(bytes, 0, outputLength)
Console.WriteLine "Decoded string:"
Console.WriteLine(string chars)
Imports System.Text
Imports System.IO
Public Class Decoder
Public Shared Sub Main()
Dim inputStream As Stream = Console.OpenStandardInput()
Dim bytes(100) As Byte
Console.WriteLine("To decode, type or paste the UTF7 encoded string and press enter:")
Console.WriteLine("(Example: ""M+APw-nchen ist wundervoll"")")
Dim outputLength As Integer = inputStream.Read(bytes, 0, 100)
Dim chars As Char() = Encoding.UTF7.GetChars(bytes, 0, outputLength)
Console.WriteLine("Decoded string:")
Console.WriteLine(New String(chars))
End Sub
End Class
This method can be used to reacquire the standard input stream after it has been changed by the SetIn method.
Acquires the standard input stream, which is set to a specified buffer size.
public:
static System::IO::Stream ^ OpenStandardInput(int bufferSize);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput(int bufferSize);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput(int bufferSize);
public static System.IO.Stream OpenStandardInput(int bufferSize);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member OpenStandardInput : int -> System.IO.Stream
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
static member OpenStandardInput : int -> System.IO.Stream
static member OpenStandardInput : int -> System.IO.Stream
Public Shared Function OpenStandardInput (bufferSize As Integer) As Stream
This parameter has no effect, but its value must be greater than or equal to zero.
The standard input stream.
bufferSize
is less than or equal to zero.
This method can be used to reacquire the standard output stream after it has been changed by the SetIn method.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in