Determine the number of open files in your program (C/C++)
The code below will display the number of files open by the running process. It does this by getting the maximum file descriptor number and then iterating through each possible fd trying to do an ‘fstat’ on it. If errno returns anything other than EBADF ‘file descriptor is bad’ it increments a count. It is …
Determine the number of open files in your program (C/C++) Read More »