简体   繁体   中英

cmd doesn't show all results

i'm wondering i started programming 6 monthes ago but never noticed that cmd can't show all results and it seems that there is limit. for example try this.

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

you may not noticed at first but if you run this it only covers from 701 to 999 and you can't find 0 to 700, it seems that cmd only can show 299 lines and the previous result will be hide if you have more than that line. Am i correct? What is the problem? whats the reason for that?

在此输入图像描述在此输入图像描述

Yes the command prompt has properties:

在此输入图像描述

And under those properties you can adjust the default buffer higher or lower as needed:

在此输入图像描述

You would need to set the buffer to the size of the loop to see all the entries.

http://msdn.microsoft.com/en-us/library/system.console.setbuffersize(v=vs.110).aspx

eg

Console.SetBufferSize(80, 1000);

You need to adjust the Console.BufferHeight property (see msdn ).

Console.BufferHeight = 1200; //set the bufferheight to 1200 lines
for (int i = 0; i < 1000; i++)
{
    Console.WriteLine(i);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM