Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Bernd Kreuss
On 03.10.2010 16:16, Honza wrote: > See also sockets: > > http://wiki.lazarus.freepascal.org/Sockets > > and pipes: > > http://www.freepascal.org/docs-html/fcl/pipes/tinputpipestream.html > > The TInputPipeStream has a "property NumBytesAvailable: DWord; [r] > Number of bytes available for rea

Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Honza
2010/10/3 Bernd Kreuss : > TIOStream seems to work the same way on linux and windows (I tested only > with wine but it worked) ...and it will block. > > It seems I really have to do the receiving of the data in a separate > thread. > > (I wanted to avoid this because the things that must be done af

Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Bernd Kreuss
On 03.10.2010 15:21, Andreas Schneider wrote: > You could use TIOStream from the unit iostream. AFAICS that should do > exactly what you want - i.e. opening stdin/out/err as a TStream > descendant. > I don't know however, if that fixes the problem you have with the > stream blocking when nothing is

Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Andreas Schneider
On Sun, 03 Oct 2010 15:05:10 +0200, Bernd Kreuss wrote: > Hi, > > this might be a stupid question but I find myself again struggling with > file IO and stdin/stdout. I am trying to do the following: > > StdIn := TFileStream.Create('/dev/stdin', fmOpenRead); > > and later on i want to poll whet

Re: [fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Honza
2010/10/3 Bernd Kreuss : > this might be a stupid question but I find myself again struggling with > file IO and stdin/stdout. I am trying to do the following: > > StdIn := TFileStream.Create('/dev/stdin', fmOpenRead); > > and later on i want to poll whether there is something to read. I want > to

[fpc-pascal] TFileStream and stdin - how to make this work?

2010-10-03 Thread Bernd Kreuss
Hi, this might be a stupid question but I find myself again struggling with file IO and stdin/stdout. I am trying to do the following: StdIn := TFileStream.Create('/dev/stdin', fmOpenRead); and later on i want to poll whether there is something to read. I want to try reading binary data that wil