[fpc-pascal] How to use pipes ?

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Feb 1 13:22:14 CET 2017


On Wed, 1 Feb 2017 05:02:05 -0700 (MST)
fredvs <fiens at hotmail.com> wrote:

> Hello.
> 
> I have done lot of search on internet about pipes without success.
> Even for Delphi. no demo nor explanation.
> The same in fpc wki page.
> 
> For example, how to use bytesavailable with pipes ?

http://wiki.freepascal.org/Executing_External_Programs#How_to_redirect_output_with_TProcess

 
> In:  
> CreatePipeHandles(InHandle, OutHandle, APipeBufferSize);
> 
> InPipe.Read(Bufferout[0],BPipeBufferSize);
> 
> What is the the ratio with APipeBufferSize vs  BPipeBufferSize ?

APipeBufferSize is how much the other process can produce before
congestion.
BPipeBufferSize is how much you want to process/eat each
iteration.
Usually APipeBufferSize >= BPipeBufferSize.

 
> And length of Bufferout[0] vs APipeBufferSize vs BPipeBufferSize ?

Bufferout[0] is just the first value. The whole Bufferout can be
written by InPipe.Read. Therefore Bufferout must be >= BPipeBufferSize.


> In short, a demo will be welcome.


Mattias



More information about the fpc-pascal mailing list