OSDN Git Service

0485e6c180f2666cec827130af2cfdd10b160a25
[linuxjm/LDP_man-pages.git] / release / man3 / gets.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Wed Jul 28 11:12:07 1993 by Rik Faith (faith@cs.unc.edu)
24 .\"
25 .\" Japanese Version Copyright (c) 1997 IMAMURA Nobutaka
26 .\"         all rights reserved.
27 .\" Translated 1997-02-14, IMAMURA Nobutaka <imamura@spp.hpc.fujitsu.co.jp>
28 .\" Updated 1999-08-29, Kentaro Shirakata <argrath@ub32.org>
29 .\" Updated 2001-11-02, Kentaro Shirakata <argrath@ub32.org>
30 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\"
32 .TH GETS 3  2008-08-06 "GNU" "Linux Programmer's Manual"
33 .SH Ì¾Á°
34 fgetc, fgets, getc, getchar, gets, ungetc \- Ê¸»ú¤Èʸ»úÎó¤ÎÆþÎÏ
35 .SH ½ñ¼°
36 .nf
37 .B #include <stdio.h>
38 .sp
39 .BI "int fgetc(FILE *" stream );
40
41 .BI "char *fgets(char *" "s" ", int " "size" ", FILE *" "stream" );
42
43 .BI "int getc(FILE *" stream );
44
45 .B "int getchar(void);"
46
47 .BI "char *gets(char *" "s" );
48
49 .BI "int ungetc(int " c ", FILE *" stream );
50 .fi
51 .SH ÀâÌÀ
52 .BR fgetc ()
53 ¤Ï¡¢
54 .I stream
55 ¤«¤é¼¡¤Îʸ»ú¤ò
56 .I unsigned char
57 ¤È¤·¤ÆÆɤߡ¢
58 .I int
59 ¤Ë¥­¥ã¥¹¥È¤·¤ÆÊÖ¤¹¡£¥Õ¥¡¥¤¥ë¤Î½ª¤ï¤ê¤ä¥¨¥é¡¼¤È¤Ê¤Ã¤¿¾ì¹ç¤Ï
60 .B EOF
61 ¤òÊÖ¤¹¡£
62 .PP
63 .BR getc ()
64 ¤Ï
65 .BR fgetc ()
66 ¤ÈƱÍͤÀ¤¬¡¢
67 .I stream
68 ¤òÊ£¿ô²óɾ²Á¤¹¤ë¥Þ¥¯¥í¤È¤·¤Æ¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
69 .PP
70 .BR getchar ()
71 ¤Ï
72 .BI "getc(" stdin ) \fR
73 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
74 .PP
75 .BR gets ()
76 ¤Ï¡¢²þ¹Ôʸ»ú¤«
77 .B EOF
78 ¤Þ¤Ç¤Î 1¹Ô¤ò
79 .I stdin
80 ¤«¤éÆɤ߹þ¤ß
81 .I s
82 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤¹¤ë
83 (ËöÈø¤Î²þ¹Ôʸ»ú¤ä
84 .B EOF
85 ¤Ï
86 .B \(aq\e0\(aq
87 ¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë)¡£
88 ¥Ð¥Ã¥Õ¥¡¡¦¥ª¡¼¥Ð¡¼¥é¥ó¤Î¥Á¥§¥Ã¥¯¤Ï¹Ô¤ï¤ì¤Ê¤¤ (²¼µ­¤Î¡Ö¥Ð¥°¡×¤ò»²¾È)¡£
89 .PP
90 .BR fgets ()
91 ¤Ï
92 .I stream
93 ¤«¤éºÇÂç¤Ç
94 .IR size " - 1"
95 ¸Ä¤Îʸ»ú¤òÆɤ߹þ¤ß¡¢
96 .I s
97 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤¹¤ë¡£Æɤ߹þ¤ß¤Ï
98 .B EOF
99 ¤Þ¤¿¤Ï²þ¹Ôʸ»ú¤òÆɤ߹þ¤ó¤À¸å¤ÇÄä»ß¤¹¤ë¡£
100 Æɤ߹þ¤Þ¤ì¤¿²þ¹Ôʸ»ú¤Ï¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤ë¡£
101 .B \(aq\e0\(aq
102 ʸ»ú¤¬°ì¤Ä¥Ð¥Ã¥Õ¥¡¤ÎÃæ¤ÎºÇ¸å¤Îʸ»ú¤Î¸å¤Ë½ñ¤­¹þ¤Þ¤ì¤ë¡£
103 .PP
104 .BR ungetc ()
105 ¤Ï¡¢¸å¤Î read Áàºî¤ÇÆɤá¤ë¤è¤¦¤Ë¡¢
106 .I c
107 ¤ò
108 .I "unsigned char"
109 ¤Ë¥­¥ã¥¹¥È¤·¤Æ
110 .I stream
111 ¤Ë½ñ¤­Ì᤹¡£
112 ½ñ¤­Ìᤵ¤ì¤¿Ê¸»ú¤ÏµÕ½ç¤ËÌᤵ¤ì¤ë;
113 ½ñ¤­Ìᤷ¤È¤·¤ÆÊݾڤµ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢°ìʸ»ú¤À¤±¤Ç¤¢¤ë¡£
114 .PP
115 ¤³¤³¤Ç½Ò¤Ù¤¿´Ø¿ô¤ä
116 .I stdio
117 ¥é¥¤¥Ö¥é¥ê¤ÎÆþÎÏ´Ø¿ô¤òƱ¤¸ÆþÎÏ¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ¸ß¤¤¤Ëº®¤¼¤Æ»È¤¦¤³¤È¤¬¤Ç¤­¤ë¡£
118 .PP
119 ¤³¤ì¤é¤Î½èÍý¤ò¥í¥Ã¥¯¤»¤º¤Ë¹Ô¤¤¤¿¤¤¤È¤­¤Ï¡¢
120 .BR unlocked_stdio (3)
121 ¤ò»²¾È¤Î¤³¤È¡£
122 .SH ÊÖ¤êÃÍ
123 .BR fgetc (),
124 .BR getc (),
125 .BR getchar ()
126 ¤Ï¡¢Ê¸»ú¤ò
127 .I unsigned char
128 ¤È¤·¤ÆÆɤó¤Ç
129 .I int
130 ¤Ë¥­¥ã¥¹¥È¤·¤ÆÊÖ¤¹¡£¥Õ¥¡¥¤¥ë¤Î½ª¤ï¤ê¤ä¥¨¥é¡¼¤Î¾ì¹ç¤Ï
131 .B EOF
132 ¤òÊÖ¤¹¡£
133 .PP
134 .BR gets ()
135 ¤È
136 .BR fgets ()
137 ¤Ï¡¢À®¸ù¤¹¤ë¤È
138 .I s
139 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤ä 1 Ê¸»ú¤âÆɤ߹þ¤ó¤Ç¤¤¤Ê¤¤¤Î¤Ë¥Õ¥¡¥¤¥ë¤Î½ª¤ï¤ê¤Ë¤Ê¤Ã¤¿
140 ¾ì¹ç¤Ë NULL ¤òÊÖ¤¹¡£
141 .PP
142 .BR ungetc ()
143 ¤ÏÀ®¸ù¤¹¤ë¤È
144 .I c
145 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï
146 .B EOF
147 ¤òÊÖ¤¹¡£
148 .SH ½àµò
149 C89, C99, POSIX.1-2001.
150 LSB ¤Ç¤Ï
151 .BR gets ()
152 ¤ÏÈó¿ä¾©¤Ç¤¢¤ë¡£
153 POSIX.1-2008 ¤Ç¤Ï
154 .BR gets ()
155 ¤Î»ÅÍͤ¬ºï½ü¤µ¤ì¤Æ¤¤¤ë¡£
156 .SH ¥Ð¥°
157 .BR gets ()
158 ¤ÏÀäÂФ˻ÈÍѤ·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
159 Á°¤â¤Ã¤Æ¥Ç¡¼¥¿¤òÃΤ뤳¤È¤Ê¤·¤Ë
160 .BR gets ()
161 ¤¬²¿Ê¸»úÆɤफ¤òÃΤ뤳¤È¤Ï¤Ç¤­¤º¡¢
162 .BR gets ()
163 ¤¬¥Ð¥Ã¥Õ¥¡¤Î½ª¤ï¤ê¤ò±Û¤¨¤Æ½ñ¤­¹þ¤ß³¤±¤ë¤¿¤á¡¢
164 .BR gets ()
165 ¤ò»È¤¦¤Î¤Ï¶Ë¤á¤Æ´í¸±¤Ç¤¢¤ë¡£
166 ¤³¤ì¤òÍøÍѤ·¤Æ¥³¥ó¥Ô¥å¡¼¥¿¤Î¥»¥­¥å¥ê¥Æ¥£¤¬Çˤé¤ì¤Æ¤­¤¿¡£
167 Âå¤ï¤ê¤Ë
168 .BR fgets ()
169 ¤ò»È¤¦¤³¤È¡£
170 .PP
171 ÆþÎÏ¥¹¥È¥ê¡¼¥à¤Î¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤Æ¡¢
172 .I stdio
173 ¥é¥¤¥Ö¥é¥ê¤ÎÆþÎÏ´Ø¿ô¤È¡¢Äã¥ì¥Ù¥ë¸Æ¤Ó½Ð¤·¤Î
174 .BR read (2)
175 ¤òº®¤¼¤Æ¸Æ¤Ó½Ð¤¹»ö¤Ï´«¤á¤é¤ì¤Ê¤¤¡£
176 ·ë²Ì¤¬¤É¤¦¤Ê¤ë¤«¤Ïʬ¤«¤é¤º¡¢¤ª¤½¤é¤¯¤¢¤Ê¤¿¤Î
177 ˾¤ó¤Ç¤¤¤ë·ë²Ì¤Ë¤Ï¤Ê¤é¤Ê¤¤¤À¤í¤¦¡£
178 .SH ´ØÏ¢¹àÌÜ
179 .BR read (2),
180 .BR write (2),
181 .BR ferror (3),
182 .BR fgetwc (3),
183 .BR fgetws (3),
184 .BR fopen (3),
185 .BR fread (3),
186 .BR fseek (3),
187 .BR getline (3),
188 .BR getwchar (3),
189 .BR puts (3),
190 .BR scanf (3),
191 .BR ungetwc (3),
192 .BR unlocked_stdio (3)