[fpc-pascal] Redirecting input to a child process

Ludo Brands ludo.brands at free.fr
Mon May 9 07:50:36 CEST 2011


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




More information about the fpc-pascal mailing list