[Scummvm-devel] eos()

Max Horn max at quendi.de
Wed Apr 27 17:19:53 CEST 2005


Am 27.04.2005 um 23:35 schrieb Marcus Comstedt:

>
> I notice that there is a new function "eos()" in the Stream class,
> documented as
>
> 	/**
> 	 * Returns true if the end of the stream has been reached.
> 	 */
> 	virtual bool eos() const = 0;
>
> Well, this is pretty clear for a ReadStream, but what does it mean for
> a WriteStream?  Maybe this declaration was intended for the ReadStream
> class rather than for the common baseclass?
>
No, it was intended for the common base class. An EOF can occur for a 
write stream, too -- e.g. if the disk is full or any other I/O error 
occurred (compare with feof). If your stream implementation doesn't 
know about any eos conditions, then it should simply always return 
false in this method (this can happen for a read stream, too, of course 
-- e.g. in the (in)famour ZeroReadStream which produces an infinity 
amount of zero bytes :-)


Cheers,

Max





More information about the Scummvm-devel mailing list