Windows 中打开文件的数量是否有限制 [英] Is there a limit on number of open files in Windows

查看:71
本文介绍了Windows 中打开文件的数量是否有限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VC++ 中用 fopen() 打开了很多文件,但过了一会儿就失败了.

可以同时打开的文件数量有限制吗?

解决方案

C 运行时库对可以在任何时间打开的文件数有 512 个限制.尝试打开超过最大数量的文件描述符或文件流会导致程序失败.使用 _setmaxstdio 更改此数字.有关这方面的更多信息可以在此处 中阅读>

此外,您可能还需要检查您的 Windows 版本是否支持您尝试使用 _setmaxstdio 设置的上限.有关 _setmaxstdio 的更多信息,请查看此处

可以找到与 VS 2015 对应的主题的信息 这里

I'm opening lots of files with fopen() in VC++ but after a while it fails.

Is there a limit to the number of files you can open simultaneously?

解决方案

The C run-time libraries have a 512 limit for the number of files that can be open at any one time. Attempting to open more than the maximum number of file descriptors or file streams causes program failure. Use _setmaxstdio to change this number. More information about this can be read here

Also you may have to check if your version of windows supports the upper limit you are trying to set with _setmaxstdio. For more information on _setmaxstdio check here

Information on the subject corresponding to VS 2015 can be found here

这篇关于Windows 中打开文件的数量是否有限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆