Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Benoît Minisini
> > Then I admit that Eof() is not useful for pipes (and other special > streams), so maybe I should make Eof() more clever: > > - If the stream is in non-blocking mode, do as before, i.e. check that > something can be read. > > - If the stream is in blocking mode, try to just read a byte, and r

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Benoît Minisini
> Benoît Minisini ha scritto: > > Well, in a few words, don't mix the behaviour of Gambas, the C library > > and the Linux kernel! > > So you are true. If someone says that tail(1) does not work with pipes, > because eof has no meaning, he is right. If someone else demonstrates > that it works, is

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Doriano Blengino
Benoît Minisini ha scritto: > > Well, in a few words, don't mix the behaviour of Gambas, the C library and > the > Linux kernel! > So you are true. If someone says that tail(1) does not work with pipes, because eof has no meaning, he is right. If someone else demonstrates that it works, is w

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Benoît Minisini
> Benoît Minisini ha scritto: > >> First you used buffered I/O, whereas PIPE in Gambas use non-buffered > >> I/O. Then you use fgetc(), which reads one character, whereas in Gambas > >> the code uses LINE INPUT, which is far more complex. So you are not > >> comparing the two same programs... > >>

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Doriano Blengino
Benoît Minisini ha scritto: >> First you used buffered I/O, whereas PIPE in Gambas use non-buffered I/O. >> Then you use fgetc(), which reads one character, whereas in Gambas the >> code uses LINE INPUT, which is far more complex. So you are not comparing >> the two same programs... >> >> Regards,

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Benoît Minisini
> > First you used buffered I/O, whereas PIPE in Gambas use non-buffered I/O. > Then you use fgetc(), which reads one character, whereas in Gambas the > code uses LINE INPUT, which is far more complex. So you are not comparing > the two same programs... > > Regards, And the same program as you w

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-08 Thread Benoît Minisini
> > No, you are not stupid - but it is false that it is stupid to use EOF > with pipes. > Just to show, I wrote a stupid short program in C (the word stupid used > three times...): > > #include > > int main(argc, argv) { > FILE* f; > int c; > > f = fopen("/tmp/fifo"

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Doriano Blengino
Benoît Minisini ha scritto: Trying the example code for pipes, I only get a waiting prompt, and then it jumps out of the loop. I added two little statements to have some output: DIM hFile AS File DIM sLine AS String hFile = PIPE "/tmp/FIFO1" FOR INPUT >>

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Benoît Minisini
> > > Trying the example code for pipes, I only get a waiting prompt, and > > > then it jumps out of the loop. > > > > > > I added two little statements to have some output: > > > > > > DIM hFile AS File > > > DIM sLine AS String > > > > > > hFile = PIPE "/tmp/FIFO1" FOR INPUT > > > > > > PRINT

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Benoît Minisini
> > Trying the example code for pipes, I only get a waiting prompt, and then > > it jumps out of the loop. > > > > I added two little statements to have some output: > > > > DIM hFile AS File > > DIM sLine AS String > > > > hFile = PIPE "/tmp/FIFO1" FOR INPUT > > > > PRINT "Now let's start:" >

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Benoît Minisini
> Trying the example code for pipes, I only get a waiting prompt, and then > it jumps out of the loop. > > I added two little statements to have some output: > > DIM hFile AS File > DIM sLine AS String > > hFile = PIPE "/tmp/FIFO1" FOR INPUT > > PRINT "Now let's start:" > > WHILE NOT Eof(hFile

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Doriano Blengino
Rolf Schmidt ha scritto: > Hi Doriano > > >>> You can't wait until EOF on a named pipe! Also a 'tail' on a named pipe >>> will never give you some data - but 'cat' do! >>> >>> Just read and find another mechanism to stop reading. >>> >> I tried cat and tail on named fifo, and both work.

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Rolf Schmidt
Hi Doriano > > You can't wait until EOF on a named pipe! Also a 'tail' on a named pipe > > will never give you some data - but 'cat' do! > > > > Just read and find another mechanism to stop reading. > > I tried cat and tail on named fifo, and both work. You can start first > either of the two side

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Rolf-Werner Eilert
Am 07.05.2010 11:33, schrieb Rolf Schmidt: > Hello Rolf-Werner > >> DIM hFile AS File >> DIM sLine AS String >> >> hFile = PIPE "/tmp/FIFO1" FOR INPUT >> >> PRINT "Now let's start:" >> >> WHILE NOT Eof(hFile) >> LINE INPUT #hFile, sLine >> PRINT sLine >> WEND >> >> PRINT "That's it." >> > >

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Doriano Blengino
Rolf Schmidt ha scritto: > Hello Rolf-Werner > >> DIM hFile AS File >> DIM sLine AS String >> >> hFile = PIPE "/tmp/FIFO1" FOR INPUT >> >> PRINT "Now let's start:" >> >> WHILE NOT Eof(hFile) >> LINE INPUT #hFile, sLine >> PRINT sLine >> WEND >> >> PRINT "That's it." >> >> > You ca

Re: [Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Rolf Schmidt
Hello Rolf-Werner > DIM hFile AS File > DIM sLine AS String > > hFile = PIPE "/tmp/FIFO1" FOR INPUT > > PRINT "Now let's start:" > > WHILE NOT Eof(hFile) >LINE INPUT #hFile, sLine >PRINT sLine > WEND > > PRINT "That's it." > You can't wait until EOF on a named pipe! Also a 'tail' on a nam

[Gambas-user] Pipe doesn't receive contents

2010-05-07 Thread Rolf-Werner Eilert
Trying the example code for pipes, I only get a waiting prompt, and then it jumps out of the loop. I added two little statements to have some output: DIM hFile AS File DIM sLine AS String hFile = PIPE "/tmp/FIFO1" FOR INPUT PRINT "Now let's start:" WHILE NOT Eof(hFile) LINE INPUT #hFile, s