[Scummvm-devel] File handling revamp

Max Horn max at quendi.de
Sat Aug 2 11:49:40 CEST 2008

Am 02.08.2008 um 07:16 schrieb Pawel Kolodziejski:

> On 2008-08-02, at 00:34, Max Horn wrote:
>> Am 01.08.2008 um 21:25 schrieb Pawel Kolodziejski:
>>> Could File class handle std, stdout console streams too ?
>> What do you mean?
> instead opening real files but standard file handles stdin, stdout,  
> stderr.
> i/o in Lua can open files real files and also this above handles.
> To allow use File class in lua, I modified File class with  
> exceptions for filenames like "(stdin)" "(stdout)" "(stderr)".
> This strings could be anything. This "()" I choose as I don't think  
> so anyone want such real file names.

I think that's a bad hack and I wouldn't want to use that in ScummVM.

If something really really needs to be able to write to either a file  
or stdout/stderr (respectively read from a file or from stdin, etc.),  
then just create new class
   StdInStream : public ReadStream {...};
   StdOutStream : public WriteStream {...};
   StdErrStream : public WriteStream {...};
Implementing those should only require a few lines of code, and they  
could stay in the Residual sources (unless we decide at some point  
that we might need them in ScummVM; but right now that doesn't seem to  
be the case, I think).


More information about the Scummvm-devel mailing list