fopen problem - too many open files
问题 I have a multithreaded application running on Win XP. At a certain stage one of a threads is failing to open an existing file using fopen function. _get_errno function returns EMFILE which means Too many open files. No more file descriptors are available . FOPEN_MAX for my platform is 20. _getmaxstdio returns 512. I checked this with WinDbg and I see that about 100 files are open: 788 Handles Type Count Event 201 Section 12 File 101 Port 3 Directory 3 Mutant 32 WindowStation 2 Semaphore 351