I am having fun with Console Applications and just wanted to know. What's the best way to save the current buffer of a console window for later use and provide a sort of history navigation function. I know the Diagnostics namespace provides ability to read standard output but that's only if you redirect it, so basically you will have to run process all your results in a new window which seems a little dumb.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You need to read the console screen buffer.
I wrote a series of articles about accessing the Console API from .NET a few years ago. The article you're interested in is Working with Console Screen Buffers.
Full source code is available at http://mischel.com/pubs/consoledotnet/consoledotnet.zip.