fgetws

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

名前

fgetws - ワイド文字の文字列を FILE ストリームから読み込む  

ライブラリ

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

書式

#include <wchar.h>

wchar_t *fgetws(int n;
         wchar_t ws[restrict n], int n, FILE *restrict stream);
 

説明

The fgetws() function is the wide-character equivalent of the fgets(3) function. It reads a string of at most n-1 wide characters into the wide-character array pointed to by ws, and adds a terminating null wide character (L'\0'). It stops reading wide characters after it has encountered and stored a newline wide character. It also stops when end of stream is reached.

プログラマは、ws には少なくとも n 文字のワイド文字を 格納できる領域を必ず確保していなければならない。

これらの処理を停止せずに行いたいときは、 unlocked_stdio(3) を参照のこと。  

返り値

fgetws() は成功すると ws を返す。 既にストリームの終わりに達しているか、エラーが起きた場合には NULL を返す。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
fgetws() Thread safetyMT-Safe
 

標準規格

C11, POSIX.1-2008.  

歴史

POSIX.1-2001, C99.  

注意

fgetws() の動作は、現在のロケールの LC_CTYPE カテゴリーに依存する。

fopen(3) システムコールに渡す追加の情報がない場合には、 fgetws() が実際にはマルチバイトシーケンスをストリームから読み込み、 これをワイド文字に変換すると期待することは適切である。

この関数は信頼できない。なぜなら、入力に含まれるかもしれない ナルワイド文字を適切に処理することができないからである。  

関連項目

fgetwc(3), unlocked_stdio(3)


 

Index

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

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