jpman project specific RCS keyword (jpman %Id) is obsolete, after manual entries are stored in freefall CVS repository. This old Id is useless and more worse it confuses users and bug reporters. So, this old Id is removed. Submitted by:jpman project <man-jp@jp.FreeBSD.org>
113 lines
3.5 KiB
Groff
113 lines
3.5 KiB
Groff
.\" Copyright (c) 1990, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd April 19, 1994
|
|
.Dt FGETLN 3
|
|
.Os
|
|
.Sh 名称
|
|
.Nm fgetln
|
|
.Nd ストリームからラインを入手
|
|
.Sh 書式
|
|
.Fd #include <stdio.h>
|
|
.Ft char *
|
|
.Fn fgetln "FILE *stream" "size_t *len"
|
|
.Sh 解説
|
|
.Fn fgetln
|
|
関数は、
|
|
.Fa stream
|
|
が参照するストリームから次のラインのポインタを戻します。
|
|
このラインは C ストリングではなく、
|
|
最後はナル文字で終了しません。
|
|
最後の改行も含めたラインの長さは、
|
|
.Fa len
|
|
が指すメモリ位置に保存されます
|
|
(ラインが、改行で終わらないファイルの最後にある場合、
|
|
戻されるテキストに改行は含まれません)。
|
|
.Sh 戻り値
|
|
問題なく終了すると、ポインタが戻されます。
|
|
このポインタは、問題の有無に関係なく、
|
|
.Fa stream
|
|
での次の
|
|
.Tn I/O
|
|
オペレーション、またはストリームが閉じられた直後で無効になります。
|
|
問題がある場合は
|
|
.Dv NULL
|
|
が戻されます。
|
|
.Fn fgetln
|
|
関数は、ファイルの終了とエラーを区別しません。
|
|
ファイルの終了かエラーかを判断するには、ルーチン
|
|
.Xr feof 3
|
|
と
|
|
.Xr ferror 3
|
|
を使用する必要があります。
|
|
エラーが発生した場合は、そのエラーを示す値にグローバル変数
|
|
.Va errno
|
|
が設定されます。
|
|
ファイルの終了条件は端末でも記憶されるので、条件が
|
|
.Xr clearerr 3
|
|
でクリアされるまで、その後の読込みでは
|
|
.Dv NULL
|
|
が常に戻されます。
|
|
.Pp
|
|
戻されたサイズ以上に変更を加えなければ、
|
|
戻されたポインタが指すテキストは修正できます。
|
|
この変更内容は、ポインタが無効になると失われます。
|
|
.Sh エラー
|
|
.Bl -tag -width [EBADF]
|
|
.It Bq Er EBADF
|
|
引数
|
|
.Fa stream
|
|
が、読込み用に開いたストリームではありません。
|
|
.Pp
|
|
.Fn fgetln
|
|
関数がエラーになると、ルーチン
|
|
.Xr fflush 3 ,
|
|
.Xr malloc 3 ,
|
|
.Xr read 2 ,
|
|
.Xr stat 2 ,
|
|
.Xr realloc 3
|
|
に指定されたエラーに
|
|
.Va errno
|
|
が設定されることがあります。
|
|
.Sh 関連項目
|
|
.Xr ferror 3 ,
|
|
.Xr fgets 3 ,
|
|
.Xr fopen 3 ,
|
|
.Xr putc 3
|
|
.Sh 歴史
|
|
.Fn fgetln
|
|
関数は、
|
|
.Bx 4.4
|
|
に追加されました。
|