Read Single Character From Input Device C# With Programming Example



In the example, showing waiting user input in the console.

using System.IO;
using System;

namespace CSharpFilesAndStreams
{
	class KbIn 
	{
		static void Main() 
		{
			char ch;
			Console.Write("Press a key followed by ENTER: ");
			ch = (char) Console.Read(); // get a char
			Console.WriteLine("Your key is: " + ch);
		}
	}
}	

0 Comment's

Comment Form

Submit Comment