Console Application

S

Scott

Does anyone know how to do a "Clear Screen" (i.e. cls)
with a C# Console Application?
 
M

Morten Wennevik

Not really, but you can always use

for(int i = 0; i < 80; i++)
{
Console.WriteLine("");
}

Or any number of lines really, 80 is max on XP, but you can still scroll
back further.
 
J

Jon Skeet [C# MVP]

Morten Wennevik said:
Not really, but you can always use

for(int i = 0; i < 80; i++)
{
Console.WriteLine("");
}

Or any number of lines really, 80 is max on XP, but you can still scroll
back further.

What do you mean by "80 is max on XP"?

I've just created a console window which is 93 lines tall, for
instance...

There is a more advanced console library out there somewhere, but I can
never remember its name...
 
M

Morten Wennevik

I seem to remember 80 was max you could select (maybe in Windows ME).
However, since you can scroll the command window in Win XP, max seems to
be more like 300.
 
J

Jon Skeet [C# MVP]

Morten Wennevik said:
I seem to remember 80 was max you could select (maybe in Windows ME).
However, since you can scroll the command window in Win XP, max seems to
be more like 300.

No - the size of the *buffer* can be set to much higher than that. I
have it set to 3000 on my box. The size of the window itself is just
limited by your display/font I believe. The limit for the buffer is
9999 (through experimentation just now; it could well be higher if you
tweak things programmatically instead of through the console window's
properties).
 
S

Scott

Is there a way to send a "cls" cmd to the Console window
instead? I'm new to C# and I don't know all the library's
I have at my disposal yet.
 
M

Morten Wennevik

Interesting. Haven't done much console buffering since the early days
where you scrolled back by tweaking the screen memory, but you couldn't
scroll very far until you did a full circle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top