2 .\" Japanese Version Copyright (c) 1999 ishikawa, keisuke
3 .\" all rights reserved.
4 .\" Translated Thu Jan 7 00:03:12 JST 1999
5 .\" by ishikawa, keisuke <ishikawa@sgk.gr.jp>
6 .\" Updated Sat May 19 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
7 .\" Updated & Modified Sun Jul 1 15:48:32 JST 2001
8 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
10 .\" Copyright (c) 1980, 1991 Regents of the University of California.
11 .\" All rights reserved.
13 .\" This code is derived from software contributed to Berkeley by
14 .\" the American National Standards Committee X3, on Information
15 .\" Processing Systems.
17 .\" Redistribution and use in source and binary forms, with or without
18 .\" modification, are permitted provided that the following conditions
20 .\" 1. Redistributions of source code must retain the above copyright
21 .\" notice, this list of conditions and the following disclaimer.
22 .\" 2. Redistributions in binary form must reproduce the above copyright
23 .\" notice, this list of conditions and the following disclaimer in the
24 .\" documentation and/or other materials provided with the distribution.
25 .\" 3. All advertising materials mentioning features or use of this software
26 .\" must display the following acknowledgement:
27 .\" This product includes software developed by the University of
28 .\" California, Berkeley and its contributors.
29 .\" 4. Neither the name of the University nor the names of its contributors
30 .\" may be used to endorse or promote products derived from this software
31 .\" without specific prior written permission.
33 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 .\" @(#)setbuf.3 6.10 (Berkeley) 6/29/91
47 .\" Converted for Linux, Mon Nov 29 14:55:24 1993, faith@cs.unc.edu
48 .\" Added section to BUGS, Sun Mar 12 22:28:33 MET 1995,
49 .\" Thomas.Koenig@ciw.uni-karlsruhe.de
50 .\" Correction, Sun, 11 Apr 1999 15:55:18,
51 .\" Martin Vicente <martin@netadmin.dgac.fr>
52 .\" Correction, 2000-03-03, Andreas Jaeger <aj@suse.de>
53 .\" Added return value for setvbuf, aeb,
55 .TH SETBUF 3 2008-06-26 "Linux" "Linux Programmer's Manual"
57 setbuf, setbuffer, setlinebuf, setvbuf \- ¥¹¥È¥ê¡¼¥à¤Î¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤ÎÁàºî
62 .BI "void setbuf(FILE *" stream ", char *" buf );
64 .BI "void setbuffer(FILE *" stream ", char *" buf ", size_t " size );
66 .BI "void setlinebuf(FILE *" stream );
68 .BI "int setvbuf(FILE *" stream ", char *" buf ", int " mode \
73 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
74 .RB ( feature_test_macros (7)
82 ¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤Ë¤Ï unbuffered, block buffered, line buffered ¤Î3¤Ä¤Î¥¿¥¤¥×¤¬
83 ¤¢¤ë¡£½ÐÎÏ¥¹¥È¥ê¡¼¥à¤Î¥¿¥¤¥×¤¬ unbuffered ¤Î¾ì¹ç¡¢¥Ç¡¼¥¿¤ò½ñ¤¹þ¤à¤È¤¹¤°¤Ë½Ð
84 ÎÏÀè¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤Þ¤ì¤ë¤«¥¿¡¼¥ß¥Ê¥ë¤Ëɽ¼¨¤µ¤ì¤ë¡£block buffered ¤Î¾ì¹ç¡¢Ê¸
85 »ú¤ÎÆɤ߽ñ¤¤Ï¥Ö¥í¥Ã¥¯Ã±°Ì¤Ç¤¤¤Ã¤Ú¤ó¤Ë¹Ô¤ï¤ì¤ë¡£line buffered ¤Î¾ì¹ç¡¢
86 ¿·¤·¤¤¹Ô¤¬½ÐÎϤµ¤ì¤ë¤«¡¢¥¿¡¼¥ß¥Ê¥ë¥Ç¥Ð¥¤¥¹¤ËÀܳ¤·¤Æ¤¤¤ë¥¹¥È¥ê¡¼¥à
87 (Ä̾\fIstdin\fP) ¤«¤é¿·¤·¤¤¹Ô¤¬ÆþÎϤµ¤ì¤ë¤Þ¤Çʸ»ú¤¬¤¿¤¯¤ï¤¨¤é¤ì¤ë¡£
88 ¥Ö¥í¥Ã¥¯¤ò¶¯À©Åª¤Ë½ÐÎϤ¹¤ë¤Ë¤Ï
92 ¤ò»²¾È¤Î¤³¤È) Ä̾¥Õ¥¡¥¤¥ë¤Ï¤¹¤Ù¤Æ block buffered ¤Ç¤¢¤ë¡£¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ
93 ½é¤á¤ÆÆþ½ÐÎϽèÍý¤ò¹Ô¤¦¤È
95 ¤¬¸Æ¤Ó½Ð¤µ¤ì¥Ð¥Ã¥Õ¥¡¤¬³ÍÆÀ¤µ¤ì¤ë¡£¤â¤· ¥¹¥È¥ê¡¼¥à¤¬ (Ä̾
97 ¤¬¤½¤¦¤Ç¤¢¤ë¤è¤¦¤Ë) ¥¿¡¼¥ß¥Ê¥ë¤ò»²¾È¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢¥Õ¥¡¥¤¥ë¤Ï line buffered ¤È
100 ¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¾ï¤Ë unbuffered ¤Ç¤¢¤ë¡£
103 ´Ø¿ô¤Ï¡¢¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ëǤ°Õ¤Î¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ¥Ð¥Ã¥Õ¥¡¤òÊѹ¹¤Ç¤¤ë¡£
106 ¤Ï¡¢¼¡¤Î 3 ¤Ä¤Î¥Þ¥¯¥í¤Î¤¦¤Á¤¤¤º¤ì¤«¤Ç¤¢¤ë:
119 unbuffered ¤Î¥Õ¥¡¥¤¥ë¤ò½ü¤¡¢
123 ¥Ð¥¤¥È°Ê¾å¤ÎÂ礤µ¤Î¥Ð¥Ã¥Õ¥¡¤ò»Ø¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤Î¥Ð¥Ã¥Õ¥¡¤Ï¸½ºß¤Î
124 ¥Ð¥Ã¥Õ¥¡¤ÎÂå¤ï¤ê¤ËÍѤ¤¤é¤ì¤ë¡£¤â¤·¡¢°ú¿ô
126 ¤¬ NULL ¤Ê¤é¤Ð¡¢¥â¡¼¥É¤À¤±¤¬Êѹ¹¤µ¤ì¤ë¡£
127 ¿·¤·¤¤¥Ð¥Ã¥Õ¥¡¤Ï¼¡¤ËÆɤ߽ñ¤¤·¤¿ºÝ¤Ë³ä¤êÅö¤Æ¤é¤ì¤ë¡£
129 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤ò¥ª¡¼¥×¥ó¤·¤¿¸å¡¢
130 ¤½¤Î¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ²¿¤é¤«¤ÎÁàºî¤ò¤¹¤ëÁ°¤Ë¤Î¤ß»ÈÍѤǤ¤ë¡£
134 ¤Î¸Æ¤Ó½Ð¤·¤Ëñ½ã¤ËÃÖ¤´¹¤¨¤ë¤³¤È¤¬¤Ç¤¤ë¡£
139 setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
144 ´Ø¿ô¤Ï¡¢¥Ð¥Ã¥Õ¥¡¥µ¥¤¥º¤¬¥Ç¥Õ¥©¥ë¥ÈÃÍ
146 ¤Ç¤Ï¤Ê¤¯°ú¿ô¤ÇÍ¿¤¨¤é¤ì¤ëÅÀ°Ê³°¤ÏƱ¤¸¤Ç¤¢¤ë¡£
151 setvbuf(stream, (char *) NULL, _IOLBF, 0);
157 ´Ø¿ô¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç 0 ¤òÊÖ¤¹¡£
158 ¼ºÇÔ¤·¤¿¾ì¹ç¡¢0 °Ê³°¤ÎÃͤòÊÖ¤¹
161 ¤¬ÉÔÀµ¤Ê¾ì¹ç¤Þ¤¿¤Ï¥ê¥¯¥¨¥¹¥È¤¬¾ò·ï¤òËþ¤¿¤µ¤Ê¤¤¾ì¹ç¤Ç¤¢¤ë)¡£
165 ¤òÀßÄꤹ¤ë¤³¤È¤â¤¢¤ë¡£
167 ¤½¤Î¾¤Î´Ø¿ô¤ÏÃͤòÊÖ¤µ¤Ê¤¤¡£
172 ´Ø¿ô¤Ï C89 ¤È C99 ¤Ë½àµò¤·¤Æ¤¤¤ë¡£
177 ´Ø¿ô¤Ï 4.2BSD ¤è¤êÁ°¤Î BSD ¤È¤Ï¸ß´¹À¤¬¤Ê¤¤¡£¤Þ¤¿ Linux ¤Ç¤â(¸Å¤¤¥Ð¡¼¥¸¥ç¥ó
178 ¤Ç¤Ï)ÍøÍѤǤ¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤¡£4.2BSD ¤ª¤è¤Ó 4.3BSD ¤Î¥·¥¹¥Æ¥à¤Ç¤Ï
180 ¤Ïɬ¤ºÄɲäΥХåե¡¡¼¤Î¥µ¥¤¥º¤ò»ÈÍѤ¹¤ë¤Î¤Ç¡¢¤³¤ì¤â»È¤¦¤Ù¤¤Ç¤Ê¤¤¡£
183 ¤òÊĤ¸¤ë»þ (¥×¥í¥°¥é¥à¤ò½ªÎ»¤¹¤ëºÝ¤Ë¤â¤³¤ì¤Ïµ¯¤¤ë) ¤Ë¤Ï¡¢
185 ¤¬»Ø¤·¼¨¤¹¶õ´Ö¤È¤¬Â¸ºß¤·¤Æ¤¤¤ë¤³¤È¤òÊݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
186 Î㤨¤Ð¡¢¼¡¤Î¤è¤¦¤Ê»È¤¤Êý¤Ïµö¤µ¤ì¤Ê¤¤:
196 printf("Hello, world!\\n");