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


errno_t _get_fmode(   
   int * pmode   


[out] pmode[out] 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 <stdlib.h><stdlib.h> <fcntl.h><fcntl.h>

有关更多兼容性信息,请参见“简介”中的 兼容性For more compatibility information, see Compatibility in the Introduction.


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

请参阅See Also

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