While you don't go into detail about what platform or compiler set you
are using, you should keep in mind that fread() on a PC may require a
different set of fopen() parameters than on a Un*x box. In particular,
for the Cygnus GNU compiler tools on a PC, you need to specify that the
file you are opening is binary by adding a "+b" to the options, otherwise
you get very strange results.
--tom