Afficher en anglais

Partage via


Console.OpenStandardInput Méthode

Définition

Acquiert le flux d'entrée standard.

Surcharges

OpenStandardInput()

Acquiert le flux d'entrée standard.

OpenStandardInput(Int32)

Acquiert le flux d'entrée standard, défini sur une taille de mémoire tampon spécifiée.

OpenStandardInput()

Acquiert le flux d'entrée standard.

C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput ();
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.IO.Stream OpenStandardInput ();
C#
public static System.IO.Stream OpenStandardInput ();

Retours

Stream

Flux d'entrée standard.

Attributs

Exemples

L'exemple suivant illustre l'utilisation de la méthode OpenStandardInput.

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

Remarques

Cette méthode peut être utilisée pour récupérer le flux d’entrée standard après qu’il a été modifié par la SetIn méthode.

Voir aussi

S’applique à

.NET 7 et autres versions
Produit Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

OpenStandardInput(Int32)

Acquiert le flux d'entrée standard, défini sur une taille de mémoire tampon spécifiée.

C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.IO.Stream OpenStandardInput (int bufferSize);
C#
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
public static System.IO.Stream OpenStandardInput (int bufferSize);
C#
public static System.IO.Stream OpenStandardInput (int bufferSize);

Paramètres

bufferSize
Int32

Ce paramètre n’a aucun effet, mais sa valeur doit être supérieure ou égale à zéro.

Retours

Stream

Flux d'entrée standard.

Attributs

Exceptions

bufferSize est inférieur ou égal à zéro.

Remarques

Cette méthode peut être utilisée pour récupérer le flux de sortie standard après qu’il a été modifié par la SetIn méthode.

Voir aussi

S’applique à

.NET 7 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
.NET Standard 2.0, 2.1