How does one read file line by line / upto a specific delimeter of an MmFile?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Mar 16 16:22:16 UTC 2020


On Mon, Mar 16, 2020 at 01:09:08PM +0000, Adnan via Digitalmars-d-learn wrote:
[...]
> Would it be wasteful to cast the entire content into a const string?

Why would it be?  It's just reinterpreting a pointer.


> Can a memory mapped file be read with a buffer?

That totally defeats the purpose of memory-mapping.  The whole idea of
memory-mapping is that the OS takes care of buffering the file data for
you.  As far as your program is concerned, the entire file is actually
"in memory" (it isn't really, but since the OS takes care of paging
parts of it in and out as necessary, and this is completely transparent
to your program, you might as well treat it as a huge consecutive array
that resides, for all intents and purposes, "in memory" -- hence the
term "virtual memory").


T

-- 
There are three kinds of people in the world: those who can count, and those who can't.


More information about the Digitalmars-d-learn mailing list