Hi, 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.
Regards, Vincent. The following procedure is from the parent application. procedure DoIt; var LogProcess: TProcess; procedure WriteLine(const s: string); var buffer: string; begin buffer := s + LineEnding; LogProcess.Input.Write(buffer, Length(buffer)); end; begin LogProcess := TProcess.Create(nil); LogProcess.Options := [poUsePipes]; LogProcess.CommandLine := 'logger.exe'; LogProcess.Execute; WriteLine('test'); WriteLine('q'); LogProcess.WaitOnExit; end; 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: program logger; {$mode objfpc}{$H+} uses Classes; var logfile: text; line: string; procedure init; begin assignfile(logfile, 'd:\troep\log.txt'); rewrite(logfile); writeln(logfile, 'Started logging'); closefile(logfile); end; procedure AppendText(line: string); begin append(logfile); writeln(logfile, line); closefile(logfile); end; begin repeat readln(line); appendText(line); until line='q'; end. _______________________________________________ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal