Redigera

Dela via


_setmaxstdio

Sets a maximum for the number of simultaneously open files at the stream I/O level.

Syntax

int _setmaxstdio(
   int new_max
);

Parameters

new_max
New maximum for the number of simultaneously open files at the stream I/O level.

Return value

Returns new_max if successful; -1 otherwise.

If new_max is less than _IOB_ENTRIES, or greater than the maximum number of handles available in the operating system, the invalid parameter handler is invoked, as described in Parameter validation. If execution is allowed to continue, this function returns -1 and sets errno to EINVAL.

For information about these and other error codes, see errno, _doserrno, _sys_errlist, and _sys_nerr.

Remarks

The _setmaxstdio function changes the maximum value for the number of files that may be open simultaneously at the stream I/O level.

C run-time I/O now supports up to 8,192 files open simultaneously at the low I/O level. This level includes files opened and accessed using the _open, _read, and _write family of I/O functions. By default, up to 512 files can be open simultaneously at the stream I/O level. This level includes files opened and accessed using the fopen, fgetc, and fputc family of functions. The limit of 512 open files at the stream I/O level can be increased to a maximum of 8,192 by use of the _setmaxstdio function.

Because stream I/O-level functions, such as fopen, are built on top of the low I/O-level functions, the maximum of 8,192 is a hard upper limit for the number of simultaneously open files accessed through the C run-time library.

Note

This upper limit might be beyond what's supported by a particular Win32 platform and configuration.

Requirements

Routine Required header
_setmaxstdio <stdio.h>

For more compatibility information, see Compatibility.

Example

See _getmaxstdio for an example of using _setmaxstdio.

See also

Stream I/O