Copy a specific part of a BYTE buffer to a structure+
===

I was working in my file loader, and i decided it was better for the next updates instead of keep using fread and fseek read the hole file to a BYTE buffer, and so did i, now i was wondering if theres no easy way of assigning part of this BYTE buffer to an structure.

I Already tried making a temp buffer with the same size as the structure, copy all the BYTE i need from the original buffer to it, and use memcpy, but it didn't work right, i just received a lot of random numbers (which i think i am receiving their pointers, but i don't know right).

Thank you for your time!

**Edit: Code**

fseek(fl,0,SEEK_END);
const int memory_size = (int)ftell(fl);


BYTE * memory = new BYTE[sizeof(BYTE)*memory_size];
fseek(fl,0,SEEK_SET);

for (int i=1;i<=memory_size;i++)
fread(&memory[i],sizeof(BYTE),1,fl);

	fclose(fl);

	int memory_pos = 0;

	/* Now we are going to define the basic structure that will hold
	 * our music data after the loading, it will be called "xm" from
	 * the structure called "XM::Memory". */


	XM::Memory xm;
	memset(&xm,0,sizeof(XM::Memory));