delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/08/04:00:41

Date: Mon, 8 Mar 1999 10:57:29 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Roy Taylor <rtaylor AT nextsteps DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Problem with fopen
In-Reply-To: <19990308035010932.AAA222.187@mike-s-toy>
Message-ID: <Pine.SUN.3.91.990308105709.23421P-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 7 Mar 1999, Roy Taylor wrote:

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

A file name is an array of characters, so you need to use "char *FileName" 
instead of "int *FileName".

> This alone changes some of the values in an array pointed to by a element
> of the TheSprite structure.

Passing incorrect arguments to functions cause the program to
overwrite other data.  To find such problems, step through the
offending code with a debugger and see which line causes the
corruption.

- Raw text -


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