By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

ReadLine and WriteLine

P: n/a
In this code for a console application:

int n;

n = Console.Read();

Console.WriteLine(n);

Console.ReadLine();

I need write the last sentence (Console.ReadLine()) twice to the program
make a pause. Can somebody tell me why? Thank you


Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Make your first line a readline()

alberto wrote:
In this code for a console application:

int n;

n = Console.Read();

Console.WriteLine(n);

Console.ReadLine();

I need write the last sentence (Console.ReadLine()) twice to the program
make a pause. Can somebody tell me why? Thank you


Nov 17 '05 #2

P: n/a
why?
<wa********@yahoo.com> escribió en el mensaje
news:11**********************@g44g2000cwa.googlegr oups.com...
Make your first line a readline()

alberto wrote:
In this code for a console application:

int n;

n = Console.Read();

Console.WriteLine(n);

Console.ReadLine();

I need write the last sentence (Console.ReadLine()) twice to the program
make a pause. Can somebody tell me why? Thank you

Nov 17 '05 #3

P: n/a
always finish console programs with newline - that's why :]
Nov 17 '05 #4

P: n/a
Console.Read() only picks up the 1st char. SO if you enter like "h"
enter it gets the h but the newline is still in the buffer and gets
picked up by your next readline.

Then you needed an aditional readline to actually wait for you to press
enter again and pause.

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.