Hello,
I have to run a console application (nmkae.exe, cl.exe, link.exe) from an MFC-SDI application (Visual Studio 6.0). I tried doing it it using CreateProcess, ShellExecute and system.
The console application prints some error messages on the console window and quits.
How can I save those error messages ?
I tried doing it using:
system ("nmake > log.txt")
I expected to get the following message in log.txt:
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
C:\Documents and Settings\Owner>
But the file was empty.
To take a log of a console application, you have to run the application in a child process which you have to create. After the execution, the details of the execution will be dumped in a readpipe. You have to extract the contents and display. The following piece of code might be helpful for you.
This is actually a part of an MFC application which creates a process and generates a log. The string pPath is the path of the console application executable. And the string lPath is the path of your log file.
To take a log of a console application, you have to run the application in a child process which you have to create. After the execution, the details of the execution will be dumped in a readpipe. You have to extract the contents and display. The following piece of code might be helpful for you.
This is actually a part of an MFC application which creates a process and generates a log. The string pPath is the path of the console application executable. And the string lPath is the path of your log file.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.