Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Console Buffer

Jerry
Beginner
890 Views
I have a windows app using dialogs to process user information and options. This app allocates a console window and executes a child process which uses the console window for it's output. How do I capture the contents of the console window, and buffer, to save to a file or send to a printer.
0 Kudos
4 Replies
Steven_L_Intel1
Employee
890 Views
When you start the child process, you can use CreateProcess and specify a file handle for standrd output, or you could use ShellExecute and use redirection in the "arguments".
0 Kudos
Jerry
Beginner
890 Views
Thanks Steve for the response. I am sharing the file handles between the calling process and the child process. My question is, once the child process has finished and the console is still active, and on the screen, I would like to capture the output from the console window and save to a file or print it based on the user specification. I don't see how to do this.
0 Kudos
Steven_L_Intel1
Employee
890 Views

If the output is actually written to the console window, I don't know how to capture it. The way I've seen this done is to use a pipe for the output handle and have code in the parent process read from the pipe and write the contents both to the console and to a file.

Looking at the Platform SDK documentation, perhaps ReadConsoleOutput could help you.

0 Kudos
garylscott
Beginner
890 Views
Try READCONSOLEOUTPUTCHARACTER()

If you want attributes, use READCONSOLEOUTPUT()

0 Kudos
Reply