C# Console OpenStandardInput(Int32)
Description
Console OpenStandardInput(Int32)
acquires the standard
input stream, which is set to a specified buffer size.
Syntax
Console.OpenStandardInput(Int32)
has the following syntax.
[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)]
public static Stream OpenStandardInput(
int bufferSize
)
Parameters
Console.OpenStandardInput(Int32)
has the following parameters.
bufferSize
- The internal stream buffer size.
Returns
Console.OpenStandardInput(Int32)
method returns The standard input stream.
Example
The following example illustrates the use of the OpenStandardInput property.
//from w w w . j a v a2s . c o m
using System;
using System.Text;
using System.IO;
public class Decoder {
public static void Main() {
Stream inputStream = Console.OpenStandardInput();
byte[] bytes = new byte[100];
int outputLength = inputStream.Read(bytes, 0, 100);
char[] chars = Encoding.UTF7.GetChars(bytes, 0, outputLength);
Console.WriteLine("Decoded string:");
Console.WriteLine(new string(chars));
}
}