im trying to read a binary file with header. so i manage to read the header by calling this:

fread(&headers, sizeof(MtexHeader), 1, fp);

the header contains the size of the real content. i call those content by calling this line:

fread(out, sizeAccordingToHeader, 1, fp);

but it always returns me an error. it gives me bad access. any1 know whats wrong?

thanks inadvance

Since fread() is C style file reading instead of C++ style file reading you might do better to post this question in C forum.