This section is based on catpages contributed by Mainichi Communications, Inc. Translated by: MYCOM team Converted by: Japanese Online Manual Project <man-jp@jp.FreeBSD.ORG> Submitted by: Kazuo Horikawa <k-horik@yk.rim.or.jp>
157 lines
4.7 KiB
Groff
157 lines
4.7 KiB
Groff
.\" Copyright (c) 1990, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
.\" Chris Torek.
|
|
.\" 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.
|
|
.\"
|
|
.\" @(#)funopen.3 8.1 (Berkeley) 6/9/93
|
|
.\"
|
|
.Dd June 9, 1993
|
|
.Dt FUNOPEN 3
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm funopen ,
|
|
.Nm fropen ,
|
|
.Nm fwopen
|
|
.Nd ¥¹¥È¥ê¡¼¥à¤Î¥ª¡¼¥×¥ó
|
|
.Sh ½ñ¼°
|
|
.Fd #include <stdio.h>
|
|
.Ft FILE *
|
|
.Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" "int (*writefn)(void *, const char *, int)" "fpos_t (*seekfn)(void *, fpos_t, int)" "int (*closefn)(void *)"
|
|
.Ft FILE *
|
|
.Fn fropen "void *cookie" "int (*readfn)(void *, char *, int)"
|
|
.Ft FILE *
|
|
.Fn fwopen "void *cookie" "int (*writefn)(void *, const char *, int)"
|
|
.Sh ²òÀâ
|
|
.Fn funopen
|
|
´Ø¿ô¤Ï¡¢ºÇÂç
|
|
4 ¤Ä¤Î¡Ö
|
|
.Tn I/O
|
|
µ¡Ç½¡×¤Ë¥¹¥È¥ê¡¼¥à¤ò´ØÏ¢ÉÕ¤±¤Þ¤¹¡£
|
|
.Fa readfn
|
|
¤«
|
|
.Fa writefn
|
|
¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£Å¬ÀÚ¤ËÆþÎϤ·¤¿
|
|
Null
|
|
¥Ý¥¤¥ó¥¿¤È¤·¤Æ¡¢¤½¤Î¾¤ò»ØÄꤹ¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£¤³¤Î
|
|
.Tn I/O
|
|
µ¡Ç½¤Ï¡¢¿·¤·¤¤¥¹¥È¥ê¡¼¥à¤ÎÆÉ¹þ¤ß¡¢½ñ¹þ¤ß¡¢¥·¡¼¥¯¡¢¥¯¥í¡¼¥º¤Ë»ÈÍѤµ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
°ìÈÌŪ¤Ë¡¢µ¡Ç½¤ò¾Êά¤¹¤ë¤È¡¢ºîÀ®¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤Ç¤Î´ØÏ¢¥ª¥Ú¥ì¡¼¥·¥ç¥ó
|
|
¤Î¼Â¹Ô¤¬¥¨¥é¡¼¤Ë¤Ê¤ê¤Þ¤¹¡£¥¯¥í¡¼¥ºµ¡Ç½¤ò¾Êά¤·¤¿¾ì¹ç¡¢¥¹¥È¥ê¡¼¥à¤òÊĤ¸
|
|
¤ë¤È¡¢¥Ð¥Ã¥Õ¥¡¤Î½ÐÎϤ¬¥Õ¥é¥Ã¥·¥å¤µ¤ì¤ÆÌäÂê¤Ê¤¯½ªÎ»¤·¤Þ¤¹¡£
|
|
.Pp
|
|
.Fa readfn ,
|
|
.Fa writefn ,
|
|
.Fa seekfn ,
|
|
.Fa closefn
|
|
¤Î¸Æ¤Ó½Ð¤·µ¬Â§¤Ï¡¢¤½¤ì¤¾¤ì
|
|
.Xr read 2 ,
|
|
.Xr write 2 ,
|
|
.Xr seek 2 ,
|
|
.Xr close 2
|
|
¤Î¤â¤Î¤ÈƱ¤¸¤Ç¤¹¤¬¡¢½¾Íè¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò°ú¿ô¤Î¾ì½ê¤Ç¡¢
|
|
.Fn funopen
|
|
¤Ë»ØÄꤵ¤ì¤¿
|
|
.Fa cookie
|
|
°ú¿ô¤¬ÅϤµ¤ì¤ë¤È¤¤¤¦°ã¤¤¤¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
ÆÉ¹þ¤ß
|
|
.Tn I/O
|
|
µ¡Ç½¤È½ñ¹þ¤ß
|
|
.Tn I/O
|
|
µ¡Ç½¤Ç¤Ï¡¢
|
|
.Xr setvbuf 3
|
|
¤ò¸Æ¤Ó½Ð¤»¤Ð¡¢´°Á´¤Ë¥Ð¥Ã¥Õ¥¡²½¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤«¥é¥¤¥ó¤Ç¥Ð¥Ã¥Õ¥¡²½¤µ¤ì
|
|
¤¿¥¹¥È¥ê¡¼¥à¤Ç´ðÁäȤʤë¥Ð¥Ã¥Õ¥¡¤òÊѹ¹¤Ç¤¤Þ¤¹¡£¥Ð¥Ã¥Õ¥¡¤Ë´°Á´¤Ë¾ðÊó¤ò
|
|
ÆþÎϤ·¤¿¤ê¡¢¥Ð¥Ã¥Õ¥¡¤ò´°Á´¤Ë¶õ¤Ë¤·¤¿¤ê¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£¤·¤«¤·¡¢¥Ð¥Ã
|
|
¥Õ¥¡²½¤µ¤ì¤Æ¤¤¤Ê¤¤¥¹¥È¥ê¡¼¥à¤«¤é¥Ð¥Ã¥Õ¥¡²½¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ËÊѹ¹¤·¤¿¤ê¡¢
|
|
¥é¥¤¥ó¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¥Õ¥é¥°¤Î¾õÂÖ¤òÊѹ¹¤·¤¿¤ê¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£¤Þ¤¿¡¢
|
|
ºÇ¶á»ØÄꤵ¤ì¤¿¤â¤Î°Ê³°¤Ç¡¢¥Ð¥Ã¥Õ¥¡¤Ç¤ÎÆÉ¹þ¤ß¸Æ¤Ó½Ð¤·¤ä½ñ¹þ¤ß¸Æ¤Ó½Ð¤·¤Î
|
|
½àÈ÷¤ò¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
¤¹¤Ù¤Æ¤Î¥æ¡¼¥¶
|
|
.Tn I/O
|
|
µ¡Ç½¤Ï¡¢\-1 ¤òÌ᤹¤³¤È¤Ç¥¨¥é¡¼¤òÊó¹ð¤·¤Þ¤¹¡£¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¡¢¤¹¤Ù
|
|
¤Æ¤Îµ¡Ç½¤Ï³°ÉôÊÑ¿ô
|
|
.Va errno
|
|
¤òŬÀÚ¤ËÀßÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
.Fn closefn
|
|
¤Ç¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢¥¹¥È¥ê¡¼¥à¤ÏÊĤ¸¤Þ¤¹¡£
|
|
.Pp
|
|
ÊØµ¹¤ò¿Þ¤ë¤¿¤á¡¢¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
|
|
.Aq Pa stdio.h
|
|
¤Ç¤Ï¡¢ÆÉ¹þ¤ßµ¡Ç½¤«½ñ¹þ¤ßµ¡Ç½¤À¤±¤ò»ØÄꤷ¤¿
|
|
.Fn funopen
|
|
¸Æ¤Ó½Ð¤·¤Î¤è¤¦¤Ê¥Þ¥¯¥í
|
|
.Fn fropen
|
|
¤È
|
|
.Fn fwopen
|
|
¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.Sh Ìá¤êÃÍ
|
|
ÌäÂê¤Ê¤¯½ªÎ»¤¹¤ë¤È¡¢
|
|
.Fn funopen
|
|
¤Ï
|
|
.Dv FILE
|
|
¥Ý¥¤¥ó¥¿¤òÌᤷ¤Þ¤¹¡£ÌäÂ꤬¤¢¤ë¾ì¹ç¤Ï
|
|
.Dv Null
|
|
¤¬Ìᤵ¤ì¡¢¤½¤Î¥¨¥é¡¼¤ò¼¨¤¹Ãͤ˥°¥í¡¼¥Ð¥ëÊÑ¿ô
|
|
.Va errno
|
|
¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
|
|
.Sh ¥¨¥é¡¼
|
|
.Bl -tag -width [EINVAL]
|
|
.It Bq Er EINVAL
|
|
.Fn funopen
|
|
´Ø¿ô¤¬¡¢ÆÉ¹þ¤ßµ¡Ç½¤«½ñ¹þ¤ßµ¡Ç½¤Ê¤·¤Ç¸Æ¤Ó½Ð¤µ¤ì¤Þ¤·¤¿¡£
|
|
.Fn funopen
|
|
´Ø¿ô¤¬¥¨¥é¡¼¤Ë¤Ê¤ë¤È¡¢¥ë¡¼¥Á¥ó
|
|
.Xr malloc 3
|
|
¤Ë»ØÄꤵ¤ì¤¿¥¨¥é¡¼¤Ë
|
|
.Va errno
|
|
¤¬ÀßÄꤵ¤ì¤ë¤³¤È¤â¤¢¤ê¤Þ¤¹¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr fcntl 2 ,
|
|
.Xr open 2 ,
|
|
.Xr fclose 3 ,
|
|
.Xr fopen 3 ,
|
|
.Xr fseek 3 ,
|
|
.Xr setbuf 3
|
|
.Sh Îò»Ë
|
|
.Fn funopen
|
|
´Ø¿ô¤Ï¡¢
|
|
.Bx 4.4
|
|
¤ËÄɲ䵤ì¤Þ¤·¤¿¡£
|
|
.Sh ¥Ð¥°
|
|
.Fn funopen
|
|
´Ø¿ô¤Ï¡¢
|
|
.Bx
|
|
°Ê³°¤Î¥·¥¹¥Æ¥à¤Ë°Ü¿¢¤Ç¤¤Ê¤¤¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£
|