× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yes, you should do a closedir() for each opendir() that you do.   In UNIX
(which these APIs are intented to emulate) directories are nothing but
specially formatted files.   When you do an opendir() you are opening that
file.   readdir() reads through it's contents, and closedir() will close
it when you're done with it...   it's no different from any other file.

It shouldn't matter if you do the stat() before or after calling
closedir(), since programs can have multiple files open at the same
time...   just use caution that you do, in fact, close them at some point
so you don't start amassing large numbers of open files...

That's my guess as to why you'd get a "maximum number of files open"..
because you're opening directories or other files and not closing them...
probably in a loop or recursive procedure...

On Tue, 22 Jan 2002 jpcarr@tredegar.com wrote:
>
> Do the directory and stream file stay open if I use an  OpenDir   and then
> do a Stat of the file?
>
> Should I do a CloseDir   after doing the Stat?
>
> I saw a message  "Maximum number of files open"  or something like that and
> wanted to know if when I should use the CloseDir
>
> If I do an Open()  and Read()  I always do a Close() on a stream file,  so
> it just follows that I should do a CloseDir too.
>
> TIA
>
> John
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.