1. Yuri Denshchik
  2. PowerBuilder
  3. Monday, 18 June 2018

I need to modify Roland's RunAndWait of_run()  from http://www.topwizprogramming.com/freecode_runandwait.html to capture process output 

So far no luck :( 

Here is the code I added before CreateProcess call:

// open file for write
ls_outputFileName = "c:\temp\output.log"
lul_file = CreateFile(ls_outputFileName, GENERIC_READ_WRITE, &
FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0)
If lul_file <> INVALID_HANDLE_VALUE Then
    setNull(lstr_si.hStdInput)
    lstr_si.hStdOutput = lul_file
    lstr_si.hStdError = lul_file;
End If
/*
Function ulong CreateFile ( &
string lpFileName, &
ulong dwDesiredAccess, &
ulong dwShareMode, &
ulong lpSecurityAttributes, &
ulong dwCreationDisposition, &
ulong dwFlagsAndAttributes, &
ulong hTemplateFile &
) Library "kernel32.dll" Alias For "CreateFileW"
*/
 
 

The file gets created but it is empty.

Here is c++ code I found:
https://stackoverflow.com/questions/7018228/how-do-i-redirect-output-to-a-file-with-createprocess

Please advise.

Thank you,

Yuri

 

Kevin Ridley Accepted Answer Pending Moderation
0
Votes
Undo

Based on what I see there, you are just creating the file.  Where is the code that writes to it?

Comment
There are no comments made yet.
  1. Tuesday, 19 June 2018
  2. PowerBuilder
  3. # 1
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

In the example you linked to, the redirection character is a DOS Command Prompt command.

What exactly is it that you want to do from PB?

Comment
That does not work

  1. Yuri Denshchik
  2. Tuesday, 19 June 2018
The file is supposed to remain open. The handle for it is passed into the CreateProcess call in the lstr_si structure.

  1. Brad Mettee
  2. Wednesday, 20 June 2018
That is what code above does. But the file is empty, where is the catch? 

  1. Yuri Denshchik
  2. Wednesday, 20 June 2018
There are no comments made yet.
  1. Tuesday, 19 June 2018
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.