c# - Why Doesn't Read() work as Expected? -


I am using Visual Studio 2008 for C #. I do not understand why this simple code does not work as expected. any idea? Thanks!

  using the system; Name Location TryRead {class program {static zero major () {int aNumber; Console Type ("Enter a letter:"); ANumber = console. Read (); ** // Program [Enter] is waiting for the key Why? ** Console.WriteLine ("The value of the character is entered:" + aumber); Console.Read (); ** // Program key does not wait for the press. Why? **}}}  

] Why the key?

When you type input characters, returns the Read method; When you press the Enter key, it ends, press Enter adds a platform-dependent line end sequence to your input (for example, Windows attaches a carriage return line line sequence).

// Why does the program key do not wait for the press?

Retrieve your input once in a bar without any interruption at once. After the reclaim of the last character, return it to the block again and repeats the cycle.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -