What happens when you step through the code? where do you get the error? Is it when it does the Stream:=tfilestream.Create(mapfile, fmopenread);

or on one of the stream.ReadBuffer(C, SizeOf(C)); statements?

If it is on the file open, then there's a problem with the file location/filename and the app can't find it.

If it's on one of the ReadBuffers then the file isn't big enough for the array..

I'm not at a Delphi PC at the moment, so I can't test anything.