C# Console OpenStandardInput()
Description
Console OpenStandardInput()
acquires the standard
input stream.
Syntax
Console.OpenStandardInput()
has the following syntax.
[HostProtectionAttribute(SecurityAction.LinkDemand, UI = true)]
public static Stream OpenStandardInput()
Returns
Console.OpenStandardInput()
method returns The standard input stream.
Example
The following example illustrates the use of the OpenStandardInput property.
// ww w.j av a2 s . co 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));
}
}