benduong
01-10-2006, 06:28 PM
Hi all,
Having read the online help I was led to believe the following code should give me the console output of my app in stdout.txt, but it does not:
szAppPath = SUPPORTDIR ^ "MyApp.exe";
if (Is(FILE_EXISTS, szAppPath)) then
LongPathToQuote(szAppPath, TRUE);
szCmdLine = szAppPath + " " + "-r";
LAAW_STARTUPINFO.dwFlags = LAAW_STARTUPINFO.dwFlags | STARTF_USESTDHANDLES;
OpenFileMode(FILE_MODE_APPEND);
CreateFile(nvFileHandle, "C:\\", "stdout.txt");
LAAW_STARTUPINFO.hStdOutput = nvFileHandle;
LAAW_PARAMETERS.bInheritHandles = TRUE;
LaunchAppAndWait("", szCmdLine, LAAW_OPTION_WAIT);
CloseFile(nvFileHandle);
endif;
I ran it in debug and stepped through the code to make sure MyApp.exe is found and that each line is executed. I checked and there is stdout.txt in C:\
but the file is blank. The same command run manually does give me output.
Have I misread the online help or what have I done wrong?
Thanks!
Ben
Having read the online help I was led to believe the following code should give me the console output of my app in stdout.txt, but it does not:
szAppPath = SUPPORTDIR ^ "MyApp.exe";
if (Is(FILE_EXISTS, szAppPath)) then
LongPathToQuote(szAppPath, TRUE);
szCmdLine = szAppPath + " " + "-r";
LAAW_STARTUPINFO.dwFlags = LAAW_STARTUPINFO.dwFlags | STARTF_USESTDHANDLES;
OpenFileMode(FILE_MODE_APPEND);
CreateFile(nvFileHandle, "C:\\", "stdout.txt");
LAAW_STARTUPINFO.hStdOutput = nvFileHandle;
LAAW_PARAMETERS.bInheritHandles = TRUE;
LaunchAppAndWait("", szCmdLine, LAAW_OPTION_WAIT);
CloseFile(nvFileHandle);
endif;
I ran it in debug and stepped through the code to make sure MyApp.exe is found and that each line is executed. I checked and there is stdout.txt in C:\
but the file is blank. The same command run manually does give me output.
Have I misread the online help or what have I done wrong?
Thanks!
Ben