www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/11/12:03:41

From: lothloriel AT bc1 DOT com (Burton Radons/Lothloriel)
Newsgroups: comp.os.msdos.djgpp
Subject: fopen bug...?
Date: Thu, 11 Sep 1997 14:23:12 GMT
Organization: precious little
Message-ID: <3417faee.5163912@news.bc1.com>
MIME-Version: 1.0
NNTP-Posting-Host: 207.34.139.23
Lines: 38
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've just spent the last half day frowning over a tiny piece of code I have.  It
doesn't do anything special, it cannot possibly require more than 20k of
volatile memory, yet somehow, it manages to get fopen to return a NULL, when the
program had before validated that the file it was trying to open was existing.

First of all, the program does a quick search through the file hierarchy,
starting at the current directory.  It spawns itself for subdirectories (Of
which it recurses only once), ignores the . and .., and the files get their
headers read and compared, then they're entered into a list if they're valid.
This goes perfectly fine for the only valid file in the hierarchy.

Then, as the program goes, main loads a subfunction that searches through that
list, attempts to load the file and fails.  The fopen ALWAYS returns null this
time, even though I've checked that it does, in fact, ask for the exact same
wordage for the file in both instances.  One time it succeeds, the other time it
fails.

This has totally lost me.  Could it be a bug in fopen?  I've had this particular
negation of a file's existence before, with the only linking factor between the
two times being that I tried to open the same file twice.  I'm totally
befuddled.  486dx2/66, 8 megs, Win95, definitely not a memory problem.
Whichever DJ version's the latest.

- Befuddled in B.C.
lothloriel AT bc1 DOT com

- Raw text -


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