Thanks Benoît!

On Mon, 2010-12-13 at 22:22 +0100, Benoît Minisini wrote:
> > > 
> > > This is a pipe. Data is available only when it has been filled by the
> > > other side. So Eof() can returns true at anytime, even if some data may
> > > be written in the future. Gambas cannot read the future yet.
> > 
> > Benoit, i got this example from the wiki.
> > http://gambasdoc.org/help/lang/pipe?v3
> 
> Then the example is wrong. I don't think I wrote it anyway.
> 
> > 
> > > > if i change to
> > > > WHILE TRUE
> > > > 
> > > > i get the ls results to console and
> > > > i get an error
> > > > 
> > > > System error. Inappropriate ioctl for device.
> > > 
> > > The error message is not very accurate. But it is normal, as reading on a
> > > pipe that has been closed on the other side is impossible.
> > > 
> > > Regards,
> > 
> > What is the right code to read a pipe if it is not with Eof() or WHILE
> > TRUE ?
> > 
> > 
> > Thanks Benoit for your answer.
> 
> In Gambas 2, you must do something like that:
> 
>   DIM hFile AS File
>   DIM sLine AS String
>   
>   hFile = PIPE "/tmp/FIFO1" FOR READ
>   
>   DO
>     TRY READ #hFile, sLine, -256
>     IF NOT sLine THEN BREAK
>     PRINT sLine;
>   LOOP
> 
> In Gambas 3, you can do that too:
> 
>   Dim hFile As File
>   Dim sLine As String
>   
>   hFile = Pipe "/tmp/FIFO1" For Read
>   
>   Do
>     Line Input #hFile, sLine
>     If hFile.EndOfFile Then Break
>     Print sLine
>   Loop
> 
> Regards,
> 

-- 
Regards,
Demosthenes Koptsis.


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to