From: "Chris" Newsgroups: comp.os.msdos.djgpp Subject: Allegro PackFile I/O Date: 8 Feb 1997 00:23:09 GMT Organization: DINGWALL+DINGWALL Lines: 33 Message-ID: <01bc1556$2282cee0$95ddf4cc@express.ca.express.ca> NNTP-Posting-Host: beauty.imag.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Heya, I have a struct which looks like this: typedef struct Map { int w, h; char name[8]; BITMAP *tiles[60][60]; } Map; So far, I've just been expirienting with drawing and scrolling the Map around the screen, but now I want to add loading/saving routines , and make a shoddy map-editor :). Right now I have a saving routine which looks like this: Map *m; pack_fwrite(m->name, 8, fl); pack_iputw(m->w, fl); pack_iputw(m->h, fl); for(x=0; x< 60; x++) for(y=0; y< 60; y++) pack_fwrite(m->tiles[x][y], sizeof(BITMAP), fl); And a loading routine which looks like this: Map *m; pack_fread(m->name, 8, fl); m->w = pack_igetw(fl); m->h = pack_igetw(fl); for(x=0; x< 60; x++) for(y=0; y< 60; y++) pack_fread(m->tiles[x][y], sizeof(BITMAP), fl); ... Of course, whenever I try to load a map I've saved, the program crashes a horrible death :). Any help is needed and appreciated! thanks, chris