Fastest way to get a part of a disk file into a particular (pre-allocated) memory address Windows/C++? -
howdo.
i'm working in native windows. said i'm looking write function prototype like:
void getdata(uint8_t* p, std::string const& fn, size_t off, size_t s, boost::function<void()> const& f); so i've chunk of memory, preallocated on heap (with new). have file on disk. i'd specify pointer chunk of memory ("p"), filename ("fn") , offset therein ("off"), size ("s") , callback ("f"). i'd subroutine call "f" when memory "p" has been populated "s" bytes file "fn" @ offset "off". guarantee "p", "s" , "off" aligned predefined power of 2, i'd no copying can possibly avoided occur. ideally, dma data disk location directly.
i've looked memory-mapping file, require copying data mapped area "p". there no faster way of doing it?
why not use memory mapping mapviewoffileex?
you can use p lpbaseaddress parameter map file wherever want in process's address space.
Comments
Post a Comment