in reply to Re: Why can't I readdir multiple times in a while loop?
in thread Why can't I readdir multiple times in a while loop?

well... there is a rewinddir function. though i've never used it and i'm not sure what it does if the directory gets altered.

jeff

Update: apparently there's also a seekdir function. i'd suggest looking into these two functions and see if they'll do what you want them to do.

Replies are listed 'Best First'.
RE: (Guildenstern) RE: Re: Why can't I readdir multiple times in a while loop?
by Guildenstern (Deacon) on Aug 24, 2000 at 22:50 UTC
    Unfortunately, using both rewinddir and seekdir didn't help. Instead of getting nothing the second time through the loop, the array was populated with the values of the files that were previously there and now nonexistent. It may have something to do with the fact that I'm running this on a Win32 platform, I dunno.
    I just moved the opendir and closedir inside the loop, and it works fine now. It makes me feel dirty to have code that opens and closes a directory handle roughly once a second, but it works for now.