我是靠谱客的博主 直率发卡,最近开发中收集的这篇文章主要介绍windows下fopen遇到文件限制的解决方法,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

昨天遇到一个问题:打开shp文件到85个时,发现再添加shp就会报错。我一开始怀疑是缓存写的有问题,后来跟踪了下,才发现问题居然在fopen,又测试下一把fopen,如果fopen读取txt,发现在读取第510个文件时就会失败。于是怀疑是文件打开数目有限制,搜索了一把,更改config.NT重启计算机还是不行。最后是使用_setmaxstdio提高了上限。

MSDN里的描述如下:

C run-time I/O now supports many more open files on Win32 platforms than in previous versions. Up to 2,048 files can be open simultaneously at the lowio level (that is, opened and accessed by means of the _open, _read, _write, and so forth family of I/O functions). Up to 512 files can be open simultaneously at the stdio level (that is, opened and accessed by means of the fopen, fgetc, fputc, and so forth family of functions). The limit of 512 open files at the stdio level can be increased to a maximum of 2,048 by means of the _setmaxstdio function.

Because stdio-level functions, such as fopen, are built on top of the lowio functions, the maximum of 2,048 is a hard upper limit for the number of simultaneously open files accessed through the C run-time library.

最后

以上就是直率发卡为你收集整理的windows下fopen遇到文件限制的解决方法的全部内容,希望文章能够帮你解决windows下fopen遇到文件限制的解决方法所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部