[fpc-pascal] Pipe vs Memory buffer.
silvioprog at gmail.com
Fri Jan 27 03:12:17 CET 2017
On Thu, Jan 26, 2017 at 8:20 PM, fredvs <fiens at hotmail.com> wrote:
> Some news from the front:
> BufferURL : array of float;
> PipeBufferSize := $4000 ;
> CreatePipeHandles(InHandle, OutHandle, PipeBufferSize);
> InPipe := TInputPipeStream.Create(InHandle);
> OutPipe := TOutputPipeStream.Create(OutHandle);
> httpget := TThreadHttpGetter.Create(opus_url,OutPipe);
> setlength(BufferURL, PipeBufferSize);
> // This to have the buffer as parameter ???
> op_test_memory(BufferURL,PipeBufferSize, Err);
> => Gives as error: -133 =>
> A required header packet was not properly formatted, contained illegal
> values, or was missing altogether.
> So it seems that the buffer was accepted, only miss the header ?
> Difficult to explore when there is no documentation how to do nor examples.
I had never tried pipes before, but it seems FPC has a unit to handle that:
`iostream`, so today I played a very simple test:
uses sysutils, iostream;
const buf_sz = 1024;
stdin := tiostream.create(iosinput);
// it is just a test, so I limited it to 1024 bytes, please read the
entire content by yourself! :-)
sz := stdin.read(buf, buf_sz);
if sz < buf_sz then
in my terminal:
$ echo "Yes" | ./project1
However, I don't know if you are searching exactly that, anyway you can
check the iosinput sources. :-)
Any idea is highly welcome.
> Many thanks ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal