delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/18/13:19:51

Message-Id: <200006181718.UAB10068@alpha.netvision.net.il>
Date: Sun, 18 Jun 2000 20:21:05 +0200
X-Mailer: Emacs 20.6 (via feedmail 8.1.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
To: "Thorsten Erdmann" <thorsten DOT erdmann AT gmx DOT de>
CC: djgpp AT delorie DOT com
In-reply-to: <8iip1b$rnq$1@riker.addcom.de> (thorsten.erdmann@gmx.de)
Subject: Re: selfmade FindFirst/FindNext
References: <8iip1b$rnq$1 AT riker DOT addcom DOT de>
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

> From: "Thorsten Erdmann" <thorsten DOT erdmann AT gmx DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sun, 18 Jun 2000 17:14:07 +0200
> 
> The problem is that I don't know when the search is over. I can allocate
> some memory during the findfirst routine and put a pointer to it into the
> five reserved bytes of ffblk. But when should I free that allocated memory?
> When there is no search result? That would be bad if a program only searches
> for the first match of the search pattern.
> 
> Any ideas? How does the DOS function do that?

DOS requires the application to allocate the space by calling the
special SetDTA function of Int 21h, so it is up to the application to
deallocate it.

Windows 9X (in its LFN API) doesn't have this limitation, but it
requires an explicit FindClose call to avoid leaking memory and other
resources needed for FindFirst and FindNext.

- Raw text -


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