Igor
Igor

Reputation: 27250

How to check which files I fopen'ed on Windows?

I received a "Too many open files" error when tried to do fopen (C++, Windows XP). Probably it happened because somewhere in my program I open files without closing them.

Is there a way on Windows to see a list of all open file descriptors (or all files that my program fopened)?

Upvotes: 2

Views: 366

Answers (4)

h0b0
h0b0

Reputation: 1869

My choice in such a case is the Sysinternals Process Explorer.

Upvotes: 1

kyoryu
kyoryu

Reputation: 13055

Rather than look for a Windows API to do it, why not keep track of it yourself? Write some function to do the opening and closing for you, and when they're called, keep track of what is opened and/or closed.

You have the info, so trying to get it from another source seems to make little sense to me.

Upvotes: 0

Andrew Aylett
Andrew Aylett

Reputation: 40700

You can find a list of open handles in Process Explorer. You can also search all open handles in the system.

Upvotes: 2

Martin Milan
Martin Milan

Reputation: 6390

Something like this might beof use...

Upvotes: 1

Related Questions