| delorie.com/archives/browse.cgi | search |
| Xref: | news2.mv.net comp.os.msdos.djgpp:2620 |
| Newsgroups: | comp.os.msdos.djgpp |
| From: | peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock) |
| Subject: | Re: Where is fcloseall () ? |
| Message-ID: | <DpoDt1.n0D@cfanews.harvard.edu> |
| Sender: | news AT cfanews DOT harvard DOT edu |
| Reply-To: | rbabcock AT cfa DOT harvard DOT edu |
| Organization: | Smithsonian Astrophysical Observatory, Cambridge, MA, USA |
| References: | <4kgqdl$o85 AT rzunews DOT unizh DOT ch> |
| Date: | Thu, 11 Apr 1996 02:05:25 GMT |
| Lines: | 34 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Alex Schroeder (alex AT zool DOT unizh DOT ch) wrote:
: Sorry, I don't know if this has popped up before: has the function
: fcloseall () been lost in DJGPP V2?
Here's what I have been using for fcloseall(). I don't recall v1 having this
function either, so there are #if's to make it work for either v1 or v2. The
general idea came from a posting here and I filled in the details by looking
at library sources. Perhaps djgpp maintainers can add this code (v2 variant
only) to a future release. It's trivial enough that I don't think I need to
give a written copyright release.
#if __GNUC__ > 1
static void close_nonstd(FILE *f)
{
if(fileno(f) >4)
fclose(f);
}
#endif
int fcloseall(void)
{
#if __GNUC__ < 2
int i;
for(i=5; i<20; i++)
{
if(_iob[i]._file > 0)
fclose(&_iob[i]);
}
#else
_fwalk(close_nonstd);
#endif
return(0);
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |