我正在做一个小项目,我想知道为什么这段代码会导致我的程序崩溃。
PLAYER_FILE_PATH -- "player.txt"
sprite=yoshi.bmp
width=64
height=64
frames=8
alignment=1
animate=1
程序
FILE *pfile = fopen(PLAYER_FILE_PATH, "r");
if (!pfile)
{
debug_printf("could not open player file for reading!\n");
return;
}
fscanf(pfile, "sprite=%s\n\
width=%d\n\
height=%d\n\
frames=%d\n\
alignment=%d\n\
animate=%d",
player_entity.entity_sprite.imgloc,
&player_entity.entity_sprite.width,
&player_entity.entity_sprite.height,
&player_entity.entity_sprite.frames,
&player_entity.entity_sprite.oscdir,
&player_entity.entity_sprite.osc);
fclose(pfile);