c - _setmaxstdio 最大打开文件数仅为 2048?

标签 c windows

http://msdn.microsoft.com/en-us/library/6e3b887c(VS.80).aspx

有没有办法使用 _wopen 使每个应用程序一次打开超过 2048 个文件。

32 或 64 位操作系统 – 相同的限制!

最佳答案

没有。 通过查看CRT源代码,我们可以知道CRT限制了最大数量。

 /*
 * Make sure the request is reasonable.
 */
_VALIDATE_RETURN(((maxnum >= _IOB_ENTRIES) && (maxnum <= _NHANDLE_)), EINVAL, -1);

NHANDLE:

#define _NHANDLE_           (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)

那些常量:

/*
 * Definition of IOINFO_L2E, the log base 2 of the number of elements in each
 * array of ioinfo structs.
 */
#define IOINFO_L2E          5

/*
 * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array
 */
#define IOINFO_ARRAY_ELTS   (1 << IOINFO_L2E)

/*
 * Definition of IOINFO_ARRAYS, maximum number of supported ioinfo arrays.
 */
#define IOINFO_ARRAYS       64

如您所见,它受到 CRT 实现的限制。

关于c - _setmaxstdio 最大打开文件数仅为 2048?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1803552/

相关文章:

c - 在 C 中取消引用指向 0 的指针

windows - 无法从 WinPE 内的 Windows 8 安装中完全删除 ProgramData

c++ - 调用 GetDisplayName 返回与 GetIconPath 相同的结果

c - 为什么这个 SHA256 函数会打印一些奇怪的字符?

c - 如何开发这个算法?

c - printf 返回 c 但出现错误是什么

C 读取由逗号分隔的数字文件

c# - 记事本如何在最近打开的文件夹中创建快捷链接

python - virtualenv 挂断了安装 setuptools

c# - 绑定(bind)和x :Bind problems with TwoWay mode