_setmaxstdio_setmaxstdio

设置在同时打开的文件数的最大stdio级别。Sets a maximum for the number of simultaneously open files at the stdio level.

语法Syntax

int _setmaxstdio(
   int newmax
);

参数Parameters

newmaxnewmax
新最大同时打开的文件在数stdio级别。New maximum for the number of simultaneously open files at the stdio level.

返回值Return Value

返回newmax如果成功; 否则为-1。Returns newmax if successful; -1 otherwise.

如果newmax是小于 _IOB_ENTRIES或更高版本操作系统的无效参数处理程序中可用的句柄的最大数量调用中所述,然后参数验证If newmax is less than _IOB_ENTRIES or greater then the maximum number of handles available in the operating system, the invalid parameter handler is invoked, as described in Parameter Validation. 如果允许执行继续,此函数将返回-1 并设置errnoEINVALIf execution is allowed to continue, this function returns -1 and sets errno to EINVAL.

有关这些及其他错误代码的信息,请参阅 _doserrno、errno、_sys_errlist 和 _sys_nerrFor information about these and other error codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.

备注Remarks

_Setmaxstdio函数更改可能在同时打开的文件数的最大值stdio级别。The _setmaxstdio function changes the maximum value for the number of files that might be simultaneously open at the stdio level.

相比早期版本,现在 C 运行时 I/O 在 Win32 平台上支持更多的打开文件。C run-time I/O now supports many more open files on Win32 platforms than in previous versions. 2048 文件最多可以同时打开lowio 级别(即,打开和访问通过 _open阅读 (_r)_write、 I/O 函数系列,依此类推)。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). 512 文件最多可以同时打开stdio 级别(即,打开和访问通过fopenfgetcfputc依次类推系列的函数)。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). 在 512 打开的文件的限制stdio级别可以增加到最大通过 2048 _setmaxstdio函数。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.

因为stdio-级别函数,如fopen,生成的顶部lowio函数,最大值为 2048 是数硬上限同时打开访问通过 C 运行时库的文件。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.

备注

此上限可能会超过特定 Win32 平台和配置所支持的文件数。This upper limit might be beyond what is supported by a particular Win32 platform and configuration.

要求Requirements

例程Routine 必需的标头Required header
_setmaxstdio_setmaxstdio <stdio.h><stdio.h>

有关更多兼容性信息,请参阅 兼容性For more compatibility information, see Compatibility.

示例Example

请参阅_getmaxstdio有关的使用示例 _setmaxstdioSee _getmaxstdio for an example of using _setmaxstdio.

请参阅See also

流 I/OStream I/O