[Gambas-user] Watching File and Pipe

Benoît Minisini gambas at ...1...
Mon Jan 7 12:29:09 CET 2013


Le 07/01/2013 12:27, Benoît Minisini a écrit :
> Le 06/01/2013 11:32, Tobias Boege a écrit :
>>>> that the File_Read() event is called without end
>>>
>>> Logical, as a normal file is always ready to be read.
>>>
>>
>> The doc says: "If at least one byte can be read". This statement is IMHO
>> ambiguous. I expected the Read() event to be raised when Lof(hFile) > 0.
>> Do you think this sentence needs clarification?
>
> Logically the Read event should not be raised if the file pointer is at
> the end of file, but this is managed by the kernel, so I can't be sure!
>

OK. Here is what the manpage of 'select' says:

	Three independent sets of file descriptors are watched. Those
	listed in 'readfds' will be watched to see if characters become
	available for reading (more precisely, to see if a read will
	not block; in particular, a file descriptor is also ready on
	end-of-file)

So even if we are on end-of-file, the Read event will be raised!

-- 
Benoît Minisini




More information about the User mailing list