views:

688

answers:

1

How can I find out the maximum number of file handles that can be open at once on a windows mobile device?

I am running a native C++ application on a windows mobile proffesional emulator and there seems to be a limit of 39 open file handles (strange number I know), where any other files I open after that returning the error code 5 (ERROR_ACCESS_DENIED).

I have been unable to find the answers to the following questions: 1) What is the limit of open file handles, how to find this limit for different devices/platforms?

2) Why is error code 5 (ERROR_ACCESS_DENIED) begin returned rather than error code 4 (ERROR_TOO_MANY_OPEN_FILES).

3) Why 39? That is prohibitivly small as I am trying to write a program which may need up to ~50.

+3  A: 

The handle count is limited by available memory. The ERROR_ACCESS_DENIED error indicates that the file system driver only see that it cannot create the file you requested, it doesn't know the underlying cause. I cannot say when ERROR_TOO_MANY_OPEN_FILES would be returned, though.

Johann Gerell
It does seem to be some arbitary system limit, although its done nothing else so I'm not sure about it being a memory limitation.As a workaround I've had to implement a simple scheduler for the right to open a file handle... hardly an elegant or complete solution but I have nothing else atm.
Akusete