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);
Run Code Online (Sandbox Code Playgroud)
该NHANDLE:
#define _NHANDLE_ (IOINFO_ARRAYS * IOINFO_ARRAY_ELTS)
Run Code Online (Sandbox Code Playgroud)
这些常数:
/*
* 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
Run Code Online (Sandbox Code Playgroud)
如您所见,它受到 CRT 实施的限制。