I have no idea how c is typecasting a single 32 bit Integer into a struct with multiple elements... Any help explaining would be greatly appreciated
Declarations
ReadingCode:struct md2_glcmd_t { float s; float t; int index; }; struct md2_model_t { struct md2_header_t header; struct md2_skin_t *skins; struct md2_texCoord_t *texcoords; struct md2_triangle_t *triangles; struct md2_frame_t *frames; int *glcmds; GLuint tex_id; };
Another example of the typecasting used...Code:ReadMD2Model (const char *filename, struct md2_model_t *mdl) { . . . fseek (fp, mdl->header.offset_glcmds, SEEK_SET); fread (mdl->glcmds, sizeof (int), mdl->header.num_glcmds, fp); . . . }
Code:. . . int i, *pglcmds; packet = (struct md2_glcmd_t *)pglcmds; . . .



LinkBack URL
About LinkBacks






Oi, C programmers good!