Hi,
I want to create menu driven condole application
(1. Do this, 2. Do that, 3. Exit)

I have a stranger problem with Console.Read()
I'm reading a character in a loop using Console.Read()
and displaying it using Console.Write()

VB Code:
  1. public static void Test()
  2. {
  3.   int i;
  4.   char c;
  5.  
  6.   while (true)
  7.   {
  8.     i = Console.Read ();
  9.  
  10.     c = (char) i;
  11.     Console.WriteLine ("Echo: {0}", c);
  12.   }
  13. }
When I press 5<Enter>, then 9<Enter> I should be getting this:
VB Code:
  1. 5
  2. Echo: 5
  3. 9
  4. Echo: 9
Instead, I'm getting this:
VB Code:
  1. 5
  2. Echo: 5
  3. Echo:        // remembers char 13 - line feed
  4. Echo:        // remembers char 10 - new line
  5.  
  6. 9
  7. Echo: 9
  8. Echo:        // remembers char 13 - line feed
  9. Echo:        // remembers char 10 - new line

After stepping through the code I realized that
the Console.Read() remembers the enter key as well (char 13 and 10)
that's why the two empty echos after the actual number.

How can I solve this? Flash the buffer?
I need to use Console.Read() for reading single digits.

Any help appreciated.