Click here to Skip to main content
15,867,964 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
How can one open more than 1000 files simultaneously in Windows 7 and Windows 8?
Please let me know the API or the process by which one can achieve this.

Regards,
Satendra
Posted
Updated 14-Aug-12 6:22am
v2
Comments
[no name] 14-Aug-12 12:03pm    
I highly doubt that you need 1000 files open at the same time. You have a serious design flaw.
Yvan Rodrigues 14-Aug-12 12:21pm    
I agree, but I'm interested if it's possible.
Sergey Alexandrovich Kryukov 14-Aug-12 15:46pm    
Did you try it? Failed? If there is a limitation, it's a limitation, why breaking through it?
--SA
Sergey Alexandrovich Kryukov 14-Aug-12 15:45pm    
Exactly.
--SA
Richard MacCutchan 14-Aug-12 13:26pm    
Please let me know the API or the process by which one can achieve this.

It's called a loop.

1 solution

The C runtime has a default limit of 512 open file handles. Considering that parts of .NET are written using the CRT, I assume the same limit holds there too. You may have to P/Invoke _setmaxstdio if you want to increase this limit.
 
Share this answer
 
Comments
satendra K 14-Aug-12 13:33pm    
_setmaxstdio(1000); I tried this api,and it is returning success i.e. it is able to increase the limit. i cross checked using _getmaxstdio(). but actually i am trying to open files using "fopen". when fopen is trying to open more than 512 files fopen is failing.
In some portals i have read that _setmaxstdio is not working in win7.Could you please suggest me other way. i am using c/c++ environment.
Nish Nishant 14-Aug-12 13:46pm    
I just verified that it works as expected in Windows 7 64 bit using VC++ 2010.
Sergey Alexandrovich Kryukov 14-Aug-12 15:47pm    
My 5.
--SA
Albert Holguin 14-Aug-12 20:27pm    
+5... although not completely sure why you'd ever want to do something like this...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900