fwide

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

fwide - FILE ストリームの入出力単位を設定または取得する  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <wchar.h>

int fwide(FILE *stream, int mode);

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

fwide():

    _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE
        || _POSIX_C_SOURCE >= 200112L
 

説明

When mode is zero, the fwide() function determines the current orientation of stream. It returns a positive value if stream is wide-character oriented, that is, if wide-character I/O is permitted but char I/O is disallowed. It returns a negative value if stream is byte oriented---that is, if char I/O is permitted but wide-character I/O is disallowed. It returns zero if stream has no orientation yet; in this case the next I/O operation might change the orientation (to byte oriented if it is a char I/O operation, or to wide-character oriented if it is a wide-character I/O operation).

一度ストリームの入出力単位が決まると、変更することはできず、 ストリームがクローズ (close) されるまで保持される。

mode がゼロでない場合には fwide() 関数は最初に stream の入出力単位を設定しようとする (mode が 0 より大きい場合にはワイド文字単位に、 mode が 0 より小さい場合にはバイト単位に設定しようとする)。 そして上記と同様に現在の入出力単位を返す。  

返り値

fwide() 関数はストリームの入出力単位の設定を試みた後にその値を返す。 正の返り値はワイド文字単位を、負の返り値はバイト単位を意味する。 返り値が 0 ならば未決定を意味する。  

標準規格

C11, POSIX.1-2008.  

歴史

POSIX.1-2001, C99.  

注意

バイト単位のストリームにワイド文字を出力にするには fprintf(3) 関数の %lc 変換や %ls 変換を使用することができる。

ワイド文字単位のストリームにバイト単位の出力を行うには fwprintf(3) 関数の %c 変換や %s 変換を使用することができる。  

関連項目

fprintf(3), fwprintf(3)


 

Index

名前
ライブラリ
書式
説明
返り値
標準規格
歴史
注意
関連項目

This document was created by man2html, using the manual pages.