Console.OpenStandardInput Console.OpenStandardInput Console.OpenStandardInput Console.OpenStandardInput Method

定義

標準入力ストリームを取得します。Acquires the standard input stream.

オーバーロード

OpenStandardInput() OpenStandardInput() OpenStandardInput() OpenStandardInput()

標準入力ストリームを取得します。Acquires the standard input stream.

OpenStandardInput(Int32) OpenStandardInput(Int32) OpenStandardInput(Int32) OpenStandardInput(Int32)

指定したバッファー サイズに設定された標準入力ストリームを取得します。Acquires the standard input stream, which is set to a specified buffer size.

OpenStandardInput() OpenStandardInput() OpenStandardInput() OpenStandardInput()

標準入力ストリームを取得します。Acquires the standard input stream.

public:
 static System::IO::Stream ^ OpenStandardInput();
public static System.IO.Stream OpenStandardInput ();
static member OpenStandardInput : unit -> System.IO.Stream
Public Shared Function OpenStandardInput () As Stream

戻り値

標準入力ストリーム。The standard input stream.

次の例は、 OpenStandardInputプロパティの使用方法を示しています。The following example illustrates the use of the OpenStandardInput property.


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 'Main
End Class 'Decoder

注釈

このメソッドは、 SetInメソッドによって変更された後に、標準入力ストリームを再取得するために使用できます。This method can be used to reacquire the standard input stream after it has been changed by the SetIn method.

こちらもご覧ください

OpenStandardInput(Int32) OpenStandardInput(Int32) OpenStandardInput(Int32) OpenStandardInput(Int32)

指定したバッファー サイズに設定された標準入力ストリームを取得します。Acquires the standard input stream, which is set to a specified buffer size.

public:
 static System::IO::Stream ^ OpenStandardInput(int bufferSize);
public static System.IO.Stream OpenStandardInput (int bufferSize);
static member OpenStandardInput : int -> System.IO.Stream
Public Shared Function OpenStandardInput (bufferSize As Integer) As Stream

パラメーター

bufferSize
Int32 Int32 Int32 Int32

内部ストリーム バッファー サイズ。The internal stream buffer size.

戻り値

標準入力ストリーム。The standard input stream.

例外

bufferSize が 0 以下です。bufferSize is less than or equal to zero.

次の例は、 OpenStandardInputプロパティの使用方法を示しています。The following example illustrates the use of the OpenStandardInput property.


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 'Main
End Class 'Decoder

注釈

このメソッドは、 SetInメソッドによって変更された後、標準出力ストリームを再取得するために使用できます。This method can be used to reacquire the standard output stream after it has been changed by the SetIn method.

こちらもご覧ください

適用対象