.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Fri Sep 8 15:48:13 1995 by Andries Brouwer (aeb@cwi.nl) .\" Modified 2013-12-31, David Malcolm .\" Split gets(3) into its own page; fgetc() et al. move to fgetc(3) .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 IMAMURA Nobutaka .\" all rights reserved. .\" Translated 1997-02-14, IMAMURA Nobutaka .\" Updated 1999-08-29, Kentaro Shirakata .\" Updated 2001-11-02, Kentaro Shirakata .\" Updated 2005-09-06, Akihiro MOTOKI .\" Updated 2012-04-30, Akihiro MOTOKI .\" .TH GETS 3 2014\-01\-24 GNU "Linux Programmer's Manual" .SH 名前 gets \- 標準入力からの文字列を取得する (非推奨) .SH 書式 .nf \fB#include \fP .sp \fBchar *gets(char *\fP\fIs\fP\fB);\fP .fi .SH 説明 \fIこの関数は使用しないこと\fP。 \fBgets\fP() は、改行文字か \fBEOF\fP までの 1行を \fIstdin\fP から読み込み \fIs\fP が指すバッファーに格納する (末尾の改行文字や \fBEOF\fP はヌルバイト (\(aq\e0\(aq) に置き換えられる)。 バッファーオーバーランのチェックは行われない (下記の「バグ」を参照)。 .SH 返り値 \fBgets\fP() は、成功すると \fIs\fP を返し、エラーや 1 文字も読み込んでいないのにファイルの終わりになった 場合に NULL を返す。 しかし、バッファーの行き過ぎのチェックが行われないため、この関数が返るという保証はない。 .SH 準拠 C89, C99, POSIX.1\-2001. LSB は \fBgets\fP() を非推奨としている。 POSIX.1\-2008 では \fBgets\fP() に廃止予定の印が付けられている。 ISO C11 では \fBgets\fP)() の規定が C 言語から削除されている。 glibc バージョン 2.16 以降では、機能検査マクロ \fB_ISOC11_SOURCE\fP が定義された 場合、glibc ヘッダーファイルでは \fBgets\fP)() の宣言が公開されない。 .SH バグ \fBgets\fP() は絶対に使用してはならない。 前もってデータを知ることなしに \fBgets\fP() が何文字読むかを知ることはできず、 \fBgets\fP() がバッファーの終わりを越えて書き込み続けるため、 \fBgets\fP() を使うのは極めて危険である。 これを利用してコンピュータのセキュリティが破られてきた。 代わりに \fBfgets\fP() を使うこと。 詳しい情報については、CWE\-242 (別名 "Use of Inherently Dangerous Function" (「本質的に危険な関数を使う」)) を参照。 http://cwe.mitre.org/data/definitions/242.html で参照できる。 .SH 関連項目 \fBread\fP(2), \fBwrite\fP(2), \fBferror\fP(3), \fBfgetc\fP(3), \fBfgets\fP(3), \fBfgetwc\fP(3), \fBfgetws\fP(3), \fBfopen\fP(3), \fBfread\fP(3), \fBfseek\fP(3), \fBgetline\fP(3), \fBgetwchar\fP(3), \fBputs\fP(3), \fBscanf\fP(3), \fBungetwc\fP(3), \fBunlocked_stdio\fP(3), \fBfeature_test_macros\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。