parsing fastq files with D

eastanon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 24 07:18:08 PDT 2016


On Thursday, 24 March 2016 at 13:38:32 UTC, Marc Schütz wrote:
> Yes, it's read into your processes memory. You can use 
> std.mmfile [1] to make things a bit more efficient. It will, 
> too, read the data into memory, but it will do so in a way 
> (memory mapping) that only loads what is actually accessed 
> (everything in your case), and that allows the operating system 
> to efficiently release and reload parts of it if memory runs 
> low.
>
> Unfortunately there is no example in the documentation, but it 
> works like this (untested):
>
> import std.mmfile;
> auto file = new MmFile(inputfile);
> string text = cast(string) file[];
> ...
>
> [1] http://dlang.org/phobos/std_mmfile.html

That is very clever. Thank you for the tip and I have implemented 
it and it works.  I feel like it is a safer way of reading a file.


More information about the Digitalmars-d-learn mailing list