[fpc-pascal] How to use pipes ?

fredvs fiens at hotmail.com
Wed Feb 1 13:44:03 CET 2017


Many thanks Mattias.

Huh, and about bytesavailable ?

See here:

 CreatePipeHandles(InHandle, OutHandle, PipeBufferSize);
InPipe := TInputPipeStream.Create(InHandle);
OutPipe := TOutputPipeStream.Create(OutHandle);

httpget := TThreadHttpGetter.Create(url, OutPipe);

// is length ok ?
 setlength(BufferURL, PipeBufferSize);
setlength(buffertemp, PipeBufferSize);

// Is it the right way to fill BufferURL ?
len := 1 ;
len2 := 0 ;
  while (len2 < PipeBufferSize) and (len > 0) do
  begin
 len := InPipe.Read(buffertemp[0],PipeBufferSize-len2);
  if len > 0 then  for i := 0 to len -1 do
    BufferURL[i+len2] := buffertemp[i] ;
      len2 := len2 + len;
   end;

Thanks.



-----
Many thanks ;-)
--
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/How-to-use-pipes-tp5727538p5727543.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.


More information about the fpc-pascal mailing list