>
> 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
> 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
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
> 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...
> >>
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,
>
> 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
>
> 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"
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
>>
> > > 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
> > 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:"
>
> 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
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.
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
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."
>>
>
>
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
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
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
17 matches
Mail list logo