获取文件 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_pipefopen,和freopenThis 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