Console.OpenStandardInput Método

Definición

Adquiere el flujo de entrada estándar.Acquires the standard input stream.

Sobrecargas

OpenStandardInput()

Adquiere el flujo de entrada estándar.Acquires the standard input stream.

OpenStandardInput(Int32)

Adquiere el flujo de entrada estándar, que se establece en un tamaño de búfer especificado.Acquires the standard input stream, which is set to a specified buffer size.

OpenStandardInput()

Adquiere el flujo de entrada estándar.Acquires the standard input stream.

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("browser")>]
static member OpenStandardInput : unit -> System.IO.Stream
static member OpenStandardInput : unit -> System.IO.Stream
Public Shared Function OpenStandardInput () As Stream

Devoluciones

Stream

Flujo de entrada estándar.The standard input stream.

Atributos

Ejemplos

En el ejemplo siguiente se muestra el uso del método OpenStandardInput.The following example illustrates the use of the OpenStandardInput method.


using namespace System;
using namespace System::Text;
using namespace System::IO;

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 ) );
}

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));
    }
}
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

Comentarios

Este método se puede usar para volver a adquirir el flujo de entrada estándar después de que el método haya cambiado SetIn .This method can be used to reacquire the standard input stream after it has been changed by the SetIn method.

Consulte también

Se aplica a

OpenStandardInput(Int32)

Adquiere el flujo de entrada estándar, que se establece en un tamaño de búfer especificado.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("browser")]
public static System.IO.Stream OpenStandardInput (int bufferSize);
public static System.IO.Stream OpenStandardInput (int bufferSize);
[<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

Parámetros

bufferSize
Int32

Este parámetro no tiene ningún efecto, pero su valor debe ser mayor o igual que cero.This parameter has no effect, but its value must be greater than or equal to zero.

Devoluciones

Stream

Flujo de entrada estándar.The standard input stream.

Atributos

Excepciones

bufferSize es menor o igual que cero.bufferSize is less than or equal to zero.

Comentarios

Este método se puede usar para volver a adquirir el flujo de salida estándar después de que el método haya cambiado SetIn .This method can be used to reacquire the standard output stream after it has been changed by the SetIn method.

Consulte también

Se aplica a