473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

writeline

Hi, Using Console.Writeline, as
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
} this writes all the data to the screen at one go. Is there away to
write one line at a time. Or possibly to resze the command widow as it
doesnt diplay all the data. Even if I scroll to the top, the first
parts missing.
Regards Robert

May 16 '06 #1
6 4516
"Ro********@yahoo.co.uk" <Ro********@yahoo.co.uk> wrote:
Hi, Using Console.Writeline, as
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
} this writes all the data to the screen at one go. Is there away to
write one line at a time.


This loop does, in fact, write one line at a time. To make it more
readable, perhaps you should either:

1) Redirect output to the 'more' command or a text file

or

2) Increase the size of your console buffer (Command Prompt properties)

or

3) Insert occasional "Press enter to continue" via:

---8<---
int lineCount = 0;
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
if (++lineCount % 24 == 0)
{
Console.Write("Press Enter to continue...");
Console.ReadLine();
}
}
--->---

-- Barry
May 16 '06 #2
Console.Out.Flush() after each write?

======================
Clive Dixon
Digita Ltd. (www.digita.com)
<Ro********@yahoo.co.uk> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi, Using Console.Writeline, as
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
} this writes all the data to the screen at one go. Is there away to
write one line at a time. Or possibly to resze the command widow as it
doesnt diplay all the data. Even if I scroll to the top, the first
parts missing.
Regards Robert

May 16 '06 #3
What appears on the console is not necessarily synchronous with the write
operation. You need to do Console.Out.Flush to force it.

======================
Clive Dixon
Digita Ltd. (www.digita.com)
"Barry Kelly" <ba***********@gmail.com> wrote in message
news:dn********************************@4ax.com...
"Ro********@yahoo.co.uk" <Ro********@yahoo.co.uk> wrote:
Hi, Using Console.Writeline, as
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
} this writes all the data to the screen at one go. Is there away to
write one line at a time.


This loop does, in fact, write one line at a time. To make it more
readable, perhaps you should either:

1) Redirect output to the 'more' command or a text file

or

2) Increase the size of your console buffer (Command Prompt properties)

or

3) Insert occasional "Press enter to continue" via:

---8<---
int lineCount = 0;
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
if (++lineCount % 24 == 0)
{
Console.Write("Press Enter to continue...");
Console.ReadLine();
}
}
--->---

-- Barry

May 16 '06 #4
Thankyou for your replys. This is a great help.
Regards Robert

May 16 '06 #5
"Clive Dixon" <cl*******************@digita.noluncheonmeat.com > wrote:
What appears on the console is not necessarily synchronous with the write
operation. You need to do Console.Out.Flush to force it.


According to Reflector, the Console Out stream has AutoFlush set to
true. The WriteLine(string) method calls Write(Char[],int,int) which
calls Flush() when AutoFlush is set to true.

-- Barry
May 16 '06 #6
I resize the Window by accessing the little icon of the Window and selecting
its properties.

<%= Clinton Gallagher

<Ro********@yahoo.co.uk> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Hi, Using Console.Writeline, as
while ((strLine = stream.ReadLine()) != null)
{
sb.Append(strLine);
Console.WriteLine(strLine);
} this writes all the data to the screen at one go. Is there away to
write one line at a time. Or possibly to resze the command widow as it
doesnt diplay all the data. Even if I scroll to the top, the first
parts missing.
Regards Robert

May 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jabailo | last post by:
This is driving me crazy. I finally got the Remoting sample chat application working almost. When I run the chat client in VS.NET it goes into an endless loop -- that's because I assume that...
7
by: shawnk | last post by:
Hello Everyone How do you format format numbers right-justified using Console.WriteLine(), i.e I need to line up numbers in vertical columns and the MSDN documentation is pretty poor Here is the...
0
by: Howard Kaikow | last post by:
I have never seen WriteLine fail to produce a NewLine, at least, not until now: I was playing with an example given on pages 51-52 of the book "A Visual Basic 6 Programmer's Toolkit". The book...
0
by: Howard Kaikow | last post by:
I have never seen WriteLine fail to produce a NewLine, at least, not until now: I was playing with an example given on pages 51-52 of the book "A Visual Basic 6 Programmer's Toolkit". The book...
5
by: portroe | last post by:
Hi I am using console.Writeline in my simple program. I do not however see anything happening in the output window when I debug, there are also no error messages, Has anybody a tip on what...
4
by: Bob | last post by:
I just recently noticed that when I start my applicatoin in debug mode, the IDE hangs (no disk or CPU activity) indefinitely (at least 20 minutes). Pausing the application shows that it's hung up...
1
by: tenspeeddrive | last post by:
According the MSDN,... The Print/PrintLine functions write display-formatted data to a sequential file....
2
by: Rico | last post by:
Hello, I have Visual Studio 2003, working on a VB.net project. When I try to step through the code, the behavior is erratic, stepping in places where no code exists, jumping over code sections...
2
by: djc | last post by:
out of all the overloads that pop up via intellisense for console.writeline() the following one confuses me: Console.WriteLine (string format, params object arg) 1) whats the deal with...
6
by: Linto81 | last post by:
Hi all I am using a writeline method to create a new page containing all required code. However, included within the page code are various asp calls. The problem I have is that the asp...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.