Why is there no std.stream anymore?

Jordi Gutiérrez Hermoso jordigh at octave.org
Mon Dec 11 20:51:41 UTC 2017


I'd like to read from a file, one byte at a time, without loading 
the whole file in memory.

I was hoping I could do something like

    auto f = File("somefile");
    foreach(c; f.byChar) {
        process(c);
    }

but there appears to be no such way to do it anymore. Instead, 
the stdlib seems to provide several functions to do chunked reads 
from the file where I have to manually manage the buffer. I see 
that D1 had a stream, but it's no longer here and I understand 
ranges are supposed to be used instead.

What's the explanation here? Why is there no more stream and what 
am I supposed to use instead? Do I really need to be manually 
managing the read buffer myself?


More information about the Digitalmars-d-learn mailing list