From: Gruber Gerhard Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro Datafiles - More Problems Date: Wed, 04 Feb 1998 16:49:52 +0100 Organization: APAnet Lines: 43 Message-ID: <34D88E20.5056175E@sis.co.at> References: NNTP-Posting-Host: 192.56.14.75 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Matt Riker wrote: > > the 'spritename' must be an int containing BLANK. If you need to use > > different > > values assign different ints to spritename. > > I could be just dumb :), but how can you but a string of letters into an > int? You should use another array where the names are stored and then use the index. You could do it like this for example: char *spritenames[4] = { "SPR1", "SPR2", "SPR3", NULL }; int foo(char *name) { int i; for(i = 0; spritenames[i] != NULL; i++) { if(strcmp(spritenames[i], name) == 0) return(i); } return(-1); } Now you know the index of the spritename and can use it to index into your datafile array. -- Bye, Gerhard email: gruber2 AT ibm DOT net g DOT gruber AT sis DOT co DOT at FIDO: Gruber_Gerhard AT 2:310/81.11