One way to implement it is to open the existing file as a memory-mapped file. Memory-mapped files only get paged into memory as the memory is referenced. So if you did a memcmp(oldfile, newfile, size), it will stop once the first difference is found, and the rest of the file is never read.


Also, only the changed pages of the memory-mapped file have to be written. On large files, this could be a big savings.

Reply via email to