@WeatherVane Re "check size first": Interesting idea;
fseek()
(the standard way) may be pretty fast and likely pays for large files. In principle though, proper byte-by-byte comparison takes care of that implicitly, by encountering EOF != <some othe char>.