delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/29/02:45:32

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointers to stucts
Date: 28 May 2000 23:35:03 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 37
Sender: nate AT mercury DOT bitbucket
Message-ID: <83snv1x3s8.fsf@mercury.bitbucket>
References: <01414368 DOT 9f063b88 AT usw-ex0103-086 DOT remarq DOT com>
X-Complaints-To: newsabuse AT supernews DOT com
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Dogansmoobs <dogansmoobsNOdoSPAM AT hotmail DOT com DOT invalid> writes:

> A while ago, I used to use Allegro.  It was great, but I spent
> way too much time wondering, how does it do that?  So one day, I
> decided to write my own library, right now only for mode 13h.
> It worked great, except for when I tried to pass a pointer to a
> stuct to a function.  My bitmap stuce looks something like this:
> 
> typedef struct bitmap
> {
>  int width;
>  int height;
>  char *dat;
> } bitmap;
> 
> If I pass the whole struct to a function, I can access it
> normally, but when I do it as allegro does, like this:
> 
> bitmap *bmp;
> bmp = loadPcxFile("file.pcx");
> 
> In the loadPcxFile function, it always crashes on the line:
> bmp->width = width;
> 
> and also in any function that tries to access the passed pointer
> to a bitmap, I get a page fault.  Is there something really
> obvious that I'm missing here???  If there is, I'd really
> appreciate if you could call me stupid and tell me what I'm
> doing wrong.

Can you post the actual code of loadPcxFile?  It probably is simple
but not without knowing what you're doing.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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