One more thing to mention is, you assign a block size when opening the file. You should make a decision:
Delphi-Quellcode:
// either
Reset(Mfile, 1);
BlockRead(Mfile, tmp, SizeOf(Integer));
// or
Reset(Mfile, SizeOf(Integer));
BlockRead(Mfile, tmp, 1);
In your case memory can get overwritten during a call to BlockRead(), even though my test didn't crash.
marabu