delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/01/13:55:36

From: "Tom Hunt" <thunt1 AT falcon DOT lhup DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: loading an array of filenames with load_bitmap
Date: Fri, 1 Dec 2000 13:36:31 -0500
Organization: East Stroudsburg University, Pennsylvania
Lines: 26
Message-ID: <908r2a$50c$1@jake.esu.edu>
NNTP-Posting-Host: thunt1.lhup.edu
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm getting erratic behavior with this block of code.  Sometimes the program
crashes in load_pcx.  Sometimes it doesn't.

#define NUM_IMAGES    3

char *names[NUM_IMAGES] = {
  "GRASS.PCX",
  "WATER.PCX",
  "FOREST.PCX"
};
...
  RGB *pal;
  BITMAP *images[NUM_IMAGES];
...
  for(int i=0; i<NUM_IMAGES; i++)
    {
      images[i] = load_bitmap(names[i], pal);
    }

When it does crash, I get a page fault from within load_pcx.  Would anyone
have an idea as to why this is happening?

Tom



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019