On Mon, 2010-12-13 at 06:55 +0100, Benoît Minisini wrote: > > Gambas2 2.21 rev3300 > > > > this example is not working in Ubuntu 10.04 AMD64 > > > > PUBLIC SUB Main() > > > > ' Prints the messages sent to a pipe > > > > DIM hFile AS File > > DIM sLine AS String > > > > hFile = PIPE "/tmp/FIFO1" FOR INPUT > > > > WHILE NOT Eof(hFile) > > LINE INPUT #hFile, sLine > > PRINT sLine > > WEND > > > > END > > > > The pipe is created ok! > > But if i make a ls > /tmp/FIFO1 > > > > nothing is appeared in console and program terminates. > > > > 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 > > 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. -- Regards, Demosthenes Koptsis. ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user