delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/02/11:31:21

Date: Sun, 2 Apr 2000 10:59:46 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: beyonddeath <justhunt1234 AT home DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: File errors but where!
In-Reply-To: <q718esg046rurv75c1c5nd8qqq5nnjejod@4ax.com>
Message-ID: <Pine.SUN.3.91.1000402105858.9367k-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 30 Mar 2000, beyonddeath wrote:

> I am using some code that will work somtimes less times than not,
> anyway when it does chances are you cant continue in the game anyway,
> the problem is that you save or load and dos gives you a big error
> that just says invalid page fault and a lotta numbers.

The DJGPP FAQ explains in sections 9.3 and 12.2 how to make sense out
of these lotta numbers.

> void dosave()
> {
> fptr = fopen("save.dat", "w+");
> fseek(fptr, 0L, SEEK_SET);
> fwrite(&player , sizeof(player), 1, fptr);
> fwrite(&days, size2, 1,fptr);

Here's your problem: you are writing binary information into the file,
but you didn't open the file in binary mode.  See section 9.4 of the
FAQ for more details.

- Raw text -


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