You just open both files in binary mode and compare every byte.
Of course, reading byte per byte is slow, so better is to read a block of bytes, say 256KB into a memory buffer and then compare the memory buffers.