From: "Ingo Ruhnke" Newsgroups: comp.os.msdos.djgpp Subject: Re: allegro bmp/pcx loading problems Date: 23 Dec 1997 17:05:38 GMT Organization: Telemedia News Server Lines: 105 Message-ID: <01bd0f19$ed841fa0$0200a8c0@ingo> References: <349d836a DOT 0 AT news3 DOT escape DOT ca> NNTP-Posting-Host: gtso-m127-87.pool.mediaways.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Mark Phillips schrieb im Beitrag <349d836a DOT 0 AT news3 DOT escape DOT ca>... > I have a program which uses allegro to load 6 bitmaps, all of size > 77x105 and i want to keep writing them over top of each other to do > some crude animation. However, half of the time when I try to compile > the program, the compiler gives me the error: "virtual memory > exhausted" the other half of the time it compiles but i get a general > protection fault after it has displayed 2 frames. What am I doing > wrong? here is the source if you're interested (I am just trying stuff > out and so I just modified one of the allegro examples). oh yeah by > the way, i accidentally overwrote allegro example #15 so if someone > could just post ex15.c that would be great too. > Here is a modified version of your example, this works on my machine. Watch the comments for explanation ====Begin==== #include #include #include /* ^ ^ if allegro.h is in your Include directory */ #define MAX_IMAGES 4 /* ^^^^^^^^^^ it makes programming easier to define your constants */ int main() /* ^^^ use int, because main must return int */ { int i; BITMAP *the_image[MAX_IMAGES]; PALLETE the_pallete[MAX_IMAGES]; char file_name[MAX_IMAGES][13] = {"run1.bmp", "run2.bmp", "run3.bmp", "run4.bmp"}; /* this gives you a more flexibility */ allegro_init(); /* you must call allegro_init() before any of the allegro functions! maybe this was the cause of the protection fault */ install_keyboard(); install_timer(); /* this is needed for rest() */ /* read in the bitmap files */ for (i=0; i