[fpc-pascal] Redirecting input to a child process
Ludo Brands
ludo.brands at free.fr
Mon May 9 10:22:22 CEST 2011
If you need these handles from the child process use:
InHnd:=GetStdHandle(STD_INPUT_HANDLE);
OutHnd:=GetStdHandle(STD_OUTPUT_HANDLE);
ErrHnd:=GetStdHandle(STD_ERROR_HANDLE);
Ludo
-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Ludo Brands
Envoyé : lundi 9 mai 2011 07:51
À : 'FPC-Pascal users discussions'
Objet : RE : RE : RE : [fpc-pascal] Redirecting input to a child process
Pipe handles can be used directly with readfile:
Var BytesRead:Longword;
windows.Readfile(mProcess.Output.Handle,str1[1],BytesAvailable,BytesRead,nil
);
can replace
mProcess.OutPut.Read(str1[1], BytesAvailable);
Ludo
-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Anton
Shepelev Envoyé : dimanche 8 mai 2011 22:26 À : FPC-Pascal users discussions
Objet : Re: RE : RE : [fpc-pascal] Redirecting input to a child process
Ludo Brands:
> > Connected with this remark, is there a way to get the underlying
> > StdIn handle in a FreePascal program, so as to read from it
> > per-character, or any other way using the OS's routines?
>
> The handles are mProcess.Input.Handle and mProcess.Out- put.Handle
I meant the program's own handles. Like instead of doing:
Read(input, c);
read directly from a handle:
Windows.ReadFile(inputHandle, ...);
Anton
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list