CSharp examples for Language Basics:Console
Read information from Console
using System;//w w w .jav a 2 s .c o m using System.Text; class ReadIt { public static void Main() { StringBuilder Input = new StringBuilder(); int ival; char ch = ' '; Console.WriteLine("Enter text. When done, press CTRL+Z:"); while ( true ) { ival = Console.Read(); if ( ival == - 1 ) break; ch = ( char ) ival; Input.Append(ch); } Console.Write( Input ); } }