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.
Asked
Active
Viewed 3,521 times
1 Answers
9
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.

Jim Mischel
- 131,090
- 20
- 188
- 351
-
@opatachibueze: Glad you found it useful. That's why I published it . . . – Jim Mischel Sep 20 '11 at 19:26
-
@JimMischel I'm interested in using your ConsoleDotNet project in something I'm working on. I have one question: what is the license for the project. I've got the source, but I don't see a copyright notice or license anywhere. (here's to hoping that it's MIT) (sorry to bug you on SO, but I couldn't find any contact info on your blog or anywhere else on the internets for that matter) – fre0n Jan 29 '13 at 01:54
-
@fre0n: MIT License. You should have checked my SO profile for my email address. Contact me there if you need more info. – Jim Mischel Jan 29 '13 at 03:13
-
@JimMischel It looks like email addresses aren't publicly visible on Stack Exchange sites. http://meta.stackexchange.com/a/77454/158214 – fre0n Jan 29 '13 at 03:51
-
@fre0n: My email address is on my home page. See "Contact" on www.mischel.com – Jim Mischel Jan 29 '13 at 06:27