recursive file search

前端 未结 6 934
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-06 13:49

I\'m trying to figure out how to work this thing out .. For some reason, it ends at a certain point.. I\'m not very good at recursion and I\'m sure the problem lies somewher

6条回答
  •  [愿得一人]
    2021-01-06 14:34

    You still have errors in your code:

    1. you ignore the results of the first search. you call FindFirstFile and handle if it fails. But if it succeeds you do not process already fetched file_data and overwrite it with FindNextFile.
    2. You don't close the search handle. Use FindClose for that.
    3. From your existing code it seems that fHandle is global - it shouldn't. It would break your recursion.

    Also I think that you can resolve all the issues in your code by paying more attention to MSDN sample provided in FindFirstFile documentation.

提交回复
热议问题