In order to make a binary comparer I’m trying to read in the binary contents of two files using the CreateFileW function. However, that causes the whole file to be bufferred into memory, and that becomes a problem for large (500MB) files.
I’ve looked around for other functions that’ll let me just buffer part of the file instead, but I haven’t found any documentation specifically stating how the buffer works for those functions (I’m a bit new at this so maybe I’m missing the obvious).
So far the best match I seem to have found is ReadFile. It seems to have a definable buffer but I’m not completely sure that there won’t be another buffer implemented behind the scenes, like there is with CreateFileW.
Do you guys have any input on what would be a good function to use?
You could use memory mapped files to do this. open with
createFile, usecreateFileMappingthenMapViewOfFileto get a pointer to the data.