phobos: What type to use instead of File when doing I/O on streams?

J.Frank via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 8 12:47:06 PST 2015


Hello again,

I'm a bit puzzled by the "File" type. Looking at the 
implementation, it seems that all I/O functions were stuffed into 
a single class^H^H^H^H^Hstruct.
What I expected to find is some kind of "Stream" class (with 
read(), write(), eof()), which is extended by a "File" class 
(with seek(), mmap(), etc.).

So, assuming my program reads from stdin and is supposed to work 
on a file as well as on a pipe (which is not seekable) - how can 
I make the compiler bark when I accidently use stdin.seek()?

Am I missing something here, too?



More information about the Digitalmars-d-learn mailing list