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

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 8 13:57:52 PST 2015


On Sunday, 8 November 2015 at 20:47:08 UTC, J.Frank wrote:
> 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?

Use ubyte/char input ranges. Post what you're trying to do if you 
want an example.


More information about the Digitalmars-d-learn mailing list