获取文件 I/O 操作的默认文件转换模式。Gets the default file translation mode for file I/O operations.


errno_t _get_fmode(
   int * pmode


指向要用当前默认模式填充的整数的指针: _O_TEXT_O_BINARYA pointer to an integer to be filled with the current default mode: _O_TEXT or _O_BINARY.

返回值Return Value

如果成功,则返回零;如果失败,则返回错误代码。Returns zero if successful; an error code on failure. 如果pmodeNULL,则将调用无效参数处理程序,如参数验证中所述。If pmode is NULL, the invalid parameter handler is invoked as described in Parameter Validation. 如果允许执行继续,则将errno设置为EINVAL ,并且函数将返回EINVALIf execution is allowed to continue, errno is set to EINVAL and the function returns EINVAL.


函数获取 _fmode 全局变量的值。The function gets the value of the _fmode global variable. 此变量为低级和流文件 i/o 操作指定默认的文件转换模式,如 _open_pipefopenfreopenThis variable specifies the default file translation mode for both low-level and stream file I/O operations, such as _open, _pipe, fopen, and freopen.


例程所返回的值Routine 必需的标头Required header 可选标头Optional header
_get_fmode_get_fmode <stdlib.h><stdlib.h> <fcntl.h><fcntl.h>

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


请参阅 _set_fmode 中的示例。See the example in _set_fmode.

请参阅See also

文本和二进制模式文件 I/OText and Binary Mode File I/O