Mail Archives: djgpp/2000/04/21/16:22:02
Greetings, Bernhard Stiftner <stiftnersoftwareNOstSPAM AT gmx DOT net DOT invalid>! You
wrote:
> Hi everyone...
Hi :).
> reboot a PC (even when running Windows), although I just
> wanted to declare an array in C ;-) ...
Negative result is also a result ;).
(skip)
> I wanted to set up an array of pointers to some BITMAP
> structures of Allegro:
> BITMAP *ani1[5]; /* I think this sets up an array of 6
> pointers (ranging von 0 to 5) to these BITMAPs */
> PALLETE junk;
No. Stop. The bug crawling right here (honestly speaking, not right here but
in you comments and understanding. By declaration of massive:
BITMAP *ani1[5];
you declaring ONLY FIVE bitmaps in array -- from zero to four not including
five.
> void load_animation(void) { /* load the files ANI000.BMP to
> ANI005.BMP into the array */
> int i;
> char *str;
> char *buf;
> char *fname;
> for (i=0; i<6; i++) {
So, that string needs to be changed:
for (i=0; i<5; i++) {
> itoa(i-1, str, 10);
Looks pretty nice. Is it starting from -1? Try to change it to 'i'.
> buf = strcat("ani100", str);
> fname = strcat(buf, ".bmp");
> ani1[i] = load_bitmap(fname, junk);
> }
> }
>
> void unload_animation(void) {
> int i;
> for (i=0; i<6; i++) {
And that too.
> destroy_bitmap(ani1[i]);
> }
> }
> So, I don't know what's wrong with my code...
> PS: I'm currently trying to teach C/C++ myself (not an easy
> task - after all, I'm a 15 years old student and I have to
> invest ***huge*** amounts of time in school (although I try
> to reduce that to the absolute minimum...)), so I hope you
> understand that I'm having some problems with C/C++ [after
> I've got used too much to really easy things like pascal...]
btw, Pascal was created for teaching structural priogramming and C was
created for implement it for the most effective way ;).
> PPS: Feel free to use my code in your own programs - that's
> really useful stuff!!! :-)
> PPPS: Don't laugh!!!
Ok, I will not as it is your license stuff :).
- Raw text -