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
End Class

설명

이 메서드는에서 변경 된 후 표준 입력된 스트림을 다시 가져오는 데 사용할 수는 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
End Class

설명

변경 된 후에 표준 출력 스트림에 다시 가져오는 데 사용할 수 있습니다이 메서드는 SetIn 메서드.This method can be used to reacquire the standard output stream after it has been changed by the SetIn method.

추가 정보

적용 대상