delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/07/22:50:20

From: "Roy Taylor" <rtaylor AT nextsteps DOT com>
To: <djgpp AT delorie DOT com>
Subject: Problem with fopen
Date: Sun, 7 Mar 1999 21:50:33 -0600
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1162
MIME-Version: 1.0
Message-ID: <19990308035010932.AAA222.187@mike-s-toy>
Reply-To: djgpp AT delorie DOT com

This may be a simple lack of experience problem, but I can't see how my
data is being corrupted.  Here's the situation:

void SaveSprite(pSprite TheSprite,int *FileName)
{
	FILE *fp;
	if((fp=fopen(FileName,"w"))==NULL)
	{
		blah..blah...
	}
	fclose(fp);
}

This alone changes some of the values in an array pointed to by a element
of the TheSprite structure.  The structure is defined as:

typedef struct Sprite
{
	int Height,Width;
	unsigned int *Bitmap;
} Sprite, *pSprite;

After the call to SaveSprite, the data in Bitmap is corrupted.  I malloced
and everything, and checked the data just before and just after the call,
and several bytes are changed.  Any assistance you could offer would be
greatly appreciated.


						-Mike Taylor

- Raw text -


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