Re: Recursive use of _findfirst & _findnext
- From: "Scot T Brennecke" <ScotB@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 Aug 2005 17:55:22 -0500
Do you allocate a new instance of your finddata structure with each invocation, or does it re-use
the same structure?
"Ray Mitchell" <RayMitchell_NOSPAM_@xxxxxxxxxxxxxxxxxx> wrote in message
news:ED2E3C48-1DDF-4EAB-91FA-D1974103F41C@xxxxxxxxxxxxxxxx
> Hello,
>
> VS2003 - C program
>
> I need to list all files in all subdirectories. My current implementation
> calls a function I wrote that starts with a call to _findfirst to get the
> first file then continues with _findnext for subsequent files. However, if
> one of the files is found to be a directory I change to that directory then
> make a recursive call to my function, which then calls _findfirst again to
> find the files in that directory. The problem comes when I return from a
> recursive call and attempt to call _findnext again. Although I haven't spent
> a lot of time debugging it I have a sneaky suspicion that _findfirst and
> _findnext are not reentrant and each time I call _findfirst at a deeper
> recursive level it destroys the ability to resume using _findnext at a
> previous level. Am I correct on this assumption? If so, what would be a
> better way to accomplish this? I would like to avoid allocating storage to
> save all the file names if possible.
>
> Thanks,
> Ray
.
- References:
- Recursive use of _findfirst & _findnext
- From: Ray Mitchell
- Recursive use of _findfirst & _findnext
- Prev by Date: Re: Operator overloading, well member function overload in general.
- Next by Date: Re: Recursive use of _findfirst & _findnext
- Previous by thread: Recursive use of _findfirst & _findnext
- Next by thread: Re: Recursive use of _findfirst & _findnext
- Index(es):