I currently writing a game for DOS to help me learn the BIOS interrupts for the VGA. I'm having trouble loading graphics from my file format. The code compiles without any warnings. I'm using DJGPP for my compiler.

Here's the code I have...

The macros and structures for the graphics memory I currently have.
Code:
#define GraphicsSize(Block)	(Block->Size + 1)
#define GraphicsNumber(Block)	(Block->Number + 1)

struct GraphicsBlock
{
	unsigned char Size;		// Width & Height
	unsigned char Number;
	unsigned char **Images;
} Tiles;
The function to load the graphics into memory.
Code:
int LoadGraphics(const char *Filename, struct GraphicsBlock *Block)
{
	FILE *File;
	int Character;
	unsigned char Number;

	if ((File = fopen(Filename, "rb")) == NULL)
	{
		// Couldn't open the file: "Filename".
		return 1;
	}

	if ((Character = fgetc(File)) == EOF)
	{
		// Couldn't get the images sizes.
		fclose(File); return 1;
	}
	Block->Size = Character;

	if ((Character = fgetc(File)) == EOF)
	{
		// Couldn't get the number of images.
		fclose(File); return 1;
	}
	Block->Number = Character;

	Block->Images = malloc(GraphicsNumber(Block) * sizeof(unsigned char *));
	if (Block->Images == NULL)
	{
		// Out of memory for storing image locations.
		fclose(File); return 1;
	}

	for (Number = 0; Number <= Block->Number; Number++)
	{
		Block->Images[Number] = malloc(GraphicsSize(Block) * GraphicsSize(Block));
		if (Block->Images[Number] == NULL)
		{
			// Not enough memory for storing the images.
			for (Character = 0; Character < Number; Character++)
				free(Block->Images[Character]);
			fclose(File); free(Block->Images); return 1;
		}

		if (fread(Block->Images[Number], GraphicsSize(Block) * GraphicsSize(Block), 1, File)
			!= GraphicsSize(Block) * GraphicsSize(Block))
		{
			// Couldn't read images from the file.
			for (Character = 0; Character <= Number; Character++)
				free(Block->Images[Character]);
			fclose(File); free(Block->Images); return 1;
		}
	}

	fclose(File); return 0;
}
As you can see; the graphics is stored in an array of pointers that points to each graphics' location in memory. I wish to get this running on the lowest specs possible, so memory isn't stored in one long storage space.

My problem is with the fread() function. It's only is reading a single byte from the file, when it should be reading 64 bytes for the file I'm loading. Both feof() & ferror() reports that nothing is wrong.

I don't have any real ideas why this is happening. Anybody else know?

Thanks in advance.