From: "Mikhail Yakshin" Newsgroups: comp.os.msdos.djgpp Subject: DJGPP and Allegro Newbie questions Date: Wed, 26 Aug 1998 20:30:46 +0400 Organization: GlasNet Lines: 60 Sender: myakshin AT glas DOT apc DOT org Message-ID: <6s1d9h$54k@glas.apc.org> NNTP-Posting-Host: ppp956.glas.apc.org Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hello, All! I'm kinda new programmer to DJGPP and Allegro, I'm now writing a game (got very interested in Allegro features, so I switched to DJGPP C from Borland Pascal). Allegro is a very good thing, but I've got some questions about C programming: I like Allegro DAT files, they are very well implemented when I need to get pictures or sounds (just grfile[MY_PIC].dat), but it's real pain to access strings of characters. For example, I have a text file (CR/LF terminated strings) and I can parse in really easy when I use real text file: FILE *f = fopen(fname,"rt"); fscanf(f,"%[^\n]\n",maptitle); fscanf(f,"%d",&mspace); [...] fclose(f); But it gets really complicated when I try to "read" my text file that was inserted in Allegro's DAT. For example, I can't just read integer number from it - I need to read string that I'll convert later to integer. I think that there should be an easier way just to use something for emulating real text file for fscanf and likes functions. Anyone knows what could it be? Question number 2 I have an array of structures named Pl which index varies from 0 to 8 (Pl[0]...Pl[8]). I need to save it all into single file. I've walked an easy way and written: f = fopen("MYGAME.SAV","wb"); fwrite(Pl, sizeof(TPLAYER), 8, f); fclose(f); (TPLAYER is a type of Pl structure, f is a file that I've opened) But this one doesn't work :( I've tried more complicated ones, like for (i=0;i<=8;i++) { fwrite(Pl[i],sizeof(TPLAYER),1,f); } but these ones don't work either :( Anyone have any suggestions? Please, also duplicate your answers with e-mail directly to me (myakshin AT glasnet DOT ru). I'm not sure that I can receive this newsgroup well... Bye!