Is there any reasons to not use "mmap" to read files?

user1234 user1234 at 12.de
Wed Feb 9 02:07:05 UTC 2022


On Sunday, 6 February 2022 at 09:40:48 UTC, rempas wrote:
> This should have probably been posted in the "Learn" section 
> but I thought that it is an advanced topic so maybe people 
> other than me may learn something too. So here we go!
>
> I'm planning to make a change to my program to use "mmap" to 
> the contents of a file rather than "fgetc". This is because I 
> learned that "mmap" can do it faster. The thing is, are there 
> any problems that can occur when using "mmap"? I need to know 
> now because changing this means changing the design of the 
> program and this is not something pleasant to do so I want to 
> be sure that I won't have to change back in the future (where 
> the project will be even bigger).

`std.file.readText()` is just fine... your really want to do an 
os with call `fgetc` for every single byte that has to be read ?


More information about the Digitalmars-d mailing list