[fpc-pascal]Using Tprocess to write to child process standard input.
VSDS at RND.VB.CBS.NL
Tue Mar 9 14:36:52 CET 2004
I am having some problems writing to the InputStream of a Tprocess
object. Below is the source code. I am testing this on windows. When
stepping through the code I get INVALID_HANDLE as return value of the
FileWrite in THandleStream.Write.
I think there is a bug somewhere in the Tprocess code for win32, but
before digging deeper I would like to know if anybody has succesfully
used Tprocess like this on win32 platform.
The following procedure is from the parent application.
procedure WriteLine(const s: string);
buffer := s + LineEnding;
LogProcess := TProcess.Create(nil);
LogProcess.Options := [poUsePipes];
LogProcess.CommandLine := 'logger.exe';
The logger application is simply reads line from stdin and writes temp
to a file, until the line 'q' is received. The source is this:
writeln(logfile, 'Started logging');
procedure AppendText(line: string);
More information about the fpc-pascal