C faster way to check if a directory exists

后端 未结 5 1875
感动是毒
感动是毒 2020-12-09 16:23

I\'m using opendir function to check if a directory exists. The problem is that I\'m using it on a massive loop and it\'s inflating the ram used by my app.

What is t

5条回答
  •  青春惊慌失措
    2020-12-09 17:14

    It sounds like you have a memory leak. Calling opendir should not inflate the RAM of your app as long as you remember to always call closedir after successfully opening a directory. Also, make sure you are freeing any buffers you allocated to compute the directory name.

提交回复
热议问题