The files I am reading in are quake 2 models. They come from windows machines.
I am not sure what you guys mean by structure padding and alignment, a google search hasn't helped me to understand either.
I never assumed portability, but I was expecting the errors at compile time and this one has me stumped. Can you please elaborate on padding/alignment for me?
ps: This was the full code block, I removed what i thought was irrelevant to make it more readable:
Code:
print_model_info( model_header );
/* Load triangles. */
if ( fseek( fp, model_header->offset_triangles, SEEK_SET ) == 0 ) {
if (( model->nr_triangles = fread( model->triangle,
sizeof(*model->triangle), model_header->nr_triangles, fp ))
!= model_header->nr_triangles ) {
fprintf( stderr, "Error reading triangles from model file (%d).\n", model->nr_triangles );
return NULL;
}
} else {
fprintf( stderr, "Error reading triangles from model file. 2\n" );
return NULL;
}
The print_model_info() call does give print the value I was expecting as well as all of the other file header info.