From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: Bizzare problem in program using DJGPP/Allegro Date: Wed, 02 Feb 2000 22:55:59 +0200 Organization: NetVision Israel Lines: 18 Message-ID: <389899DF.41991F5B@is.elta.co.il> References: <14a024ed DOT 437a99bd AT usw-ex0105-037 DOT remarq DOT com> NNTP-Posting-Host: ras1-p22.rvt.netvision.net.il Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.netvision.net.il 949524979 25971 62.0.172.24 (2 Feb 2000 20:56:19 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 2 Feb 2000 20:56:19 GMT X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,ru,hebrew To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Litmus Dragon wrote: > > When playgame.exe calls loadmain() and reads the first itmammo > [x], the printf value returns the correct value. Once it is > done reading the entire itmammo array from the file, it still is > return the correct values (for every variable in the array). > However if I did a printf of one of the itmammo[x] variables at > the end of the loadmain() function (right after I call > pack_fclose(packf)) and it returns 0! No matter which of the > variabels in the array I point it to. My advice would be to run the offending program in a debugger and put a data breakpoint (a.k.a. watchpoint) at one of the elements of the array that get zeroed out. Then, when some code overwrites it with a zero, the debugger will kick in and show you which part of your program does that. Watchpoints can work magic in cases like this one, when you have no idea what part of the program overwrites some memory.