我可以保存以供将来使用控制台窗口的缓冲区或内容? [英] Can I save the buffer or contents of a console window for future use?
问题描述
我有控制台应用程序的乐趣和只是想知道。什么是保存以供日后使用控制台窗口的当前缓冲区,并提供了一种历史导航功能的最佳途径。我知道诊断命名空间提供读取标准输出的能力,但如果你把它重定向,这只是,所以基本上你将不得不运行过程中,似乎有点哑一个新窗口中的所有搜索结果。
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.
推荐答案
您需要阅读控制台屏幕缓冲区。
You need to read the console screen buffer.
我写了一系列的文章有关访问控制台API从.NET几年前。你感兴趣的文章工作与控制台屏幕缓冲器的。
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.
完整的源代码,请 http://mischel.com/pubs/consoledotnet/consoledotnet.zip 。
这篇关于我可以保存以供将来使用控制台窗口的缓冲区或内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!