OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / fmemopen.3
index 3083563..16ecf40 100644 (file)
@@ -1,8 +1,18 @@
 .\" Copyright 2005 walter harms (walter.harms@informatik.uni-oldenburg.de),
-.\" and Copyright 2005 Michael Kerrisk <mtk.manpages@gmail.com>
+.\" and Copyright 2005, 2012 Michael Kerrisk <mtk.manpages@gmail.com>
+.\"
+.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
 .\" Distributed under the GPL.
+.\" %%%LICENSE_END
+.\"
 .\" 2008-12-04, Petr Baudis <pasky@suse.cz>: Document open_wmemstream()
 .\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
 .\" Japanese Version Copyright (c) 2005, 2006 Akihiro MOTOKI
 .\"                     all rights reserved.
 .\" Translated 2005-12-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated 2006-07-20, Akihiro MOTOKI
 .\" Updated 2008-11-08, Akihiro MOTOKI, LDP v3.13
 .\" Updated 2010-04-18, Akihiro MOTOKI, LDP v3.24
+.\" Updated 2012-05-30, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH FMEMOPEN 3 2010-09-15 "GNU" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O fmemopen, open_memstream, open_wmemstream \-  open memory as stream
-fmemopen, open_memstream, open_wmemstream \-  ¥á¥â¥ê¤ò¥¹¥È¥ê¡¼¥à¤È¤·¤Æ¥ª¡¼¥×¥ó¤¹¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH FMEMOPEN 3 2012\-04\-28 GNU "Linux Programmer's Manual"
+.SH 名前
+fmemopen, open_memstream, open_wmemstream \- メモリをストリームとしてオープンする
+.SH 書式
 .nf
-.B #include <stdio.h>
+\fB#include <stdio.h>\fP
 
-.BI "FILE *fmemopen(void *"buf ", size_t "size ", const char *" mode ");"
+\fBFILE *fmemopen(void *\fP\fIbuf\fP\fB, size_t \fP\fIsize\fP\fB, const char *\fP\fImode\fP\fB);\fP
 
-.BI "FILE *open_memstream(char **" ptr ", size_t *" sizeloc );
+\fBFILE *open_memstream(char **\fP\fIptr\fP\fB, size_t *\fP\fIsizeloc\fP\fB);\fP
 
-.B #include <wchar.h>
+\fB#include <wchar.h>\fP
 
-.BI "FILE *open_wmemstream(wchar_t **" ptr ", size_t *" sizeloc );
-.fi
+\fBFILE *open_wmemstream(wchar_t **\fP\fIptr\fP\fB, size_t *\fP\fIsizeloc\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
-.BR fmemopen (),
-.BR open_memstream (),
-.BR open_wmemstream ():
+\fBfmemopen\fP(), \fBopen_memstream\fP(), \fBopen_wmemstream\fP():
 .PD 0
 .ad l
 .RS 4
-.TP 4
-.\"O Since glibc 2.10:
-glibc 2.10 °Ê¹ß:
+.TP  4
+glibc 2.10 以降:
 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
-.TP
-.\"O Before glibc 2.10:
-glibc 2.10 ¤è¤êÁ°:
+.TP 
+glibc 2.10 より前:
 _GNU_SOURCE
 .RE
 .ad
 .PD
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O The
-.\"O .BR fmemopen ()
-.\"O function opens a stream that permits the access specified by
-.\"O .IR mode .
-.\"O The stream allows I/O to be performed on the string or memory buffer
-.\"O pointed to by
-.\"O .IR buf .
-.\"O This buffer must be at least
-.\"O .I size
-.\"O bytes long.
-.BR fmemopen ()
-´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤ò¥ª¡¼¥×¥ó¤·¡¢¤½¤Î¥¹¥È¥ê¡¼¥à¤Ë
-.I mode
-¤Ç»ØÄꤵ¤ì¤¿¥¢¥¯¥»¥¹µö²Ä¤òÀßÄꤹ¤ë¡£
-¤½¤Î¥¹¥È¥ê¡¼¥à¤òÄ̤¸¤Æ¡¢
-.I buf
-¤Ç»ØÄꤵ¤ì¤¿Ê¸»úÎó¤ä¥á¥â¥ê¥Ð¥Ã¥Õ¥¡¤Ø¤ÎÆɤ߽ñ¤­¤¬¤Ç¤­¤ë¡£
-¤³¤Î¥Ð¥Ã¥Õ¥¡¤Ï¾¯¤Ê¤¯¤È¤â
-.I size
-¥Ð¥¤¥È¤ÎŤµ¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+.SH 説明
+\fBfmemopen\fP()  関数は、ストリームをオープンし、そのストリームに \fImode\fP で指定されたアクセス許可を設定する。
+そのストリームを通じて、 \fIbuf\fP で指定された文字列やメモリバッファへの読み書きができる。 このバッファは少なくとも \fIsize\fP
+バイトの長さでなければならない。
 .PP
-.\"O The argument
-.\"O .I mode
-.\"O is the same as for
-.\"O .BR fopen (3).
-.\"O If
-.\"O .I mode
-.\"O specifies an append mode, then the initial file position is set to
-.\"O the location of the first null byte (\(aq\\0\(aq) in the buffer;
-.\"O otherwise the initial file position is set to the start of the buffer.
-°ú¤­¿ô
-.I mode
-¤Ï
-.BR fopen (3)
-¤Î¾ì¹ç¤ÈƱ¤¸¤Ç¤¢¤ë¡£
-.I mode
-¤ÇÄɵ­¥â¡¼¥É (append mode) ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢¥Õ¥¡¥¤¥ë°ÌÃ֤νé´üÃͤÏ
-¥Ð¥Ã¥Õ¥¡Ãæ¤ÎºÇ½é¤Î NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤Î°ÌÃÖ¤ËÀßÄꤵ¤ì¤ë¡£
-¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë°ÌÃ֤νé´üÃͤϥХåե¡¤ÎÀèƬ¤Ë¤Ê¤ë¡£
-.\"O Since glibc 2.9,
-.\"O the letter 'b' may be specified as the second character in
-.\"O .IR mode .
-.\"O This provides "binary" mode:
-.\"O writes don't implicitly add a terminating null byte, and
-.\"O .BR fseek (3)
-.\"O .B SEEK_END
-.\"O is relative to the end of the buffer (i.e., the value specified by the
-.\"O .I size
-.\"O argument), rather than the current string length.
-glibc 2.9 °Ê¹ß¤Ç¤Ï¡¢Ê¸»ú 'b' ¤ò
-.I mode
-¤ÎÆóÈÖÌܤÎʸ»ú¤È¤·¤Æ»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
-¤³¤Îʸ»ú¤Ï¡Ö¥Ð¥¤¥Ê¥ê¡×¥â¡¼¥É¤ò»ØÄꤹ¤ë¤â¤Î¤Ç¤¢¤ë¡£
-¤³¤Î¥â¡¼¥É¤Ç¤Ï¡¢½ñ¤­¹þ¤ß»þ¤Ëʸ»úÎó½ªÃ¼¤Î¥Ì¥ë¥Ð¥¤¥È¤¬ÌۤäÆÄɲÃ
-¤µ¤ì¤ë¤³¤È¤Ï¤Ê¤¤¡£¤Þ¤¿¡¢
-.BR fseek (3)
-.B SEEK_END
-¤Ï¡¢Ê¸»úÎó¤ÎŤµ¤«¤é¤ÎÁêÂÐÃͤǤϤʤ¯¡¢¥Ð¥Ã¥Õ¥¡¤ÎËöÈø
-.RI ( size
-¤Ç»ØÄꤷ¤¿ÃÍ) ¤«¤é¤ÎÁêÂÐÃͤȤʤ롣
+引き数 \fImode\fP は \fBfopen\fP(3) の場合と同じである。 \fImode\fP で追記モード
+(append mode) が指定された場合、ファイル位置の初期値は バッファ中の
+最初の NULL バイト (\(aq\e0\(aq) の位置に設定される。
+それ以外の場合は、ファイル位置の初期値はバッファの先頭になる。
+glibc 2.9 以降では、文字 \(aqb\(aq を \fImode\fP の二番目の文字として指定
+することができる。 この文字は「バイナリ」モードを指定するものである。
+このモードでは、書き込み時に文字列終端のヌルバイトが黙って追加 される
+ことはない。また、 \fBfseek\fP(3) \fBSEEK_END\fP は、文字列の長さからの相対値
+ではなく、バッファの末尾 (\fIsize\fP で指定した値) からの相対値となる。
 .PP
-.\"O When a stream that has been opened for writing is flushed
-.\"O .RB ( fflush (3))
-.\"O or closed
-.\"O .RB ( fclose (3)),
-.\"O a null byte is written at the end of the buffer if there is space.
-.\"O The caller should ensure that an extra byte is available in the
-.\"O buffer
-.\"O (and that
-.\"O .I size
-.\"O counts that byte)
-.\"O to allow for this.
-½ñ¤­¹þ¤ßÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ò¥Õ¥é¥Ã¥·¥å
-.RB ( fflush (3))
-¤ä¥¯¥í¡¼¥º
-.RB ( fclose (3))
-¤·¤¿»þ¤Ë¡¢
-(¥Ð¥Ã¥Õ¥¡¤Ë¶õ¤­¤¬¤¢¤ì¤Ð) NULL ¥Ð¥¤¥È¤¬¥Ð¥Ã¥Õ¥¡¤ÎËöÈø¤Ë½ñ¤­¹þ¤Þ¤ì¤ë¡£
-¤³¤Î¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤Ï
-¥Ð¥Ã¥Õ¥¡¤Ë 1¥Ð¥¤¥È;͵¤òºî¤ë
-.RI ( size
-¤Ë¤³¤Î 1¥Ð¥¤¥È¤ò´Þ¤á¤¿Ãͤò»ØÄꤹ¤ë) É¬Íפ¬¤¢¤ë¡£
+書き込み用にオープンされたストリームをフラッシュ (\fBfflush\fP(3))  やクローズ (\fBfclose\fP(3))  した時に、
+(バッファに空きがあれば) NULL バイトがバッファの末尾に書き込まれる。 このようにするためには、呼び出し元は バッファに 1バイト余裕を作る
+(\fIsize\fP にこの 1バイトを含めた値を指定する) 必要がある。
 
-.\"O Attempts to write more than
-.\"O .I size
-.\"O bytes to the buffer result in an error.
-¥Ð¥Ã¥Õ¥¡¤Ë
-.I size
-¥Ð¥¤¥È¤è¤ê¤¿¤¯¤µ¤ó½ñ¤­¹þ¤â¤¦¤È¤·¤¿¾ì¹ç¤Ë¤Ï¡¢¥¨¥é¡¼¤È¤Ê¤ë¡£
-.\"O (By default, such errors will only be visible when the
-.\"O .I stdio
-.\"O buffer is flushed.
-.\"O Disabling buffering with
-.\"O .I setbuf(fp,\ NULL)
-.\"O may be useful to detect errors at the time of an output operation.
-.\"O Alternatively, the caller can explicitly set
-.\"O .I buf
-.\"O as the stdio stream buffer, at the same time informing stdio
-.\"O of the buffer's size, using
-.\"O .IR "setbuffer(fp, buf, size)" .)
-(¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¤³¤Î¤è¤¦¤Ê¥¨¥é¡¼¤¬¸«¤¨¤ë¤Î¤Ï
-.I stdio
-¥Ð¥Ã¥Õ¥¡¤¬¥Õ¥é¥Ã¥·¥å¤µ¤ì¤¿»þ¤À¤±¤Ç¤¢¤ë¡£
-.I setbuf(fp,\ NULL)
-¤ò»È¤Ã¤Æ¥Ð¥Ã¥Õ¥¡¥ê¥ó¥°¤ò̵¸ú¤Ë¤¹¤ëÊýË¡¤Ï¡¢
-½ÐÎÏÁàºî¤ò¹Ô¤Ã¤¿»þÅÀ¤Ç¥¨¥é¡¼¤ò¸¡½Ð¤¹¤ë¤Î¤ËÌòΩ¤Ä¡£
-Ê̤ÎÊýË¡¤È¤·¤Æ¤Ï¡¢
-.IR "setbuffer(fp, buf, size)"
-¤ò»È¤Ã¤Æ¡¢¸Æ¤Ó½Ð¤·Â¦¤¬ÌÀ¼¨Åª¤Ë
-stdio ¥¹¥È¥ê¡¼¥à¥Ð¥Ã¥Õ¥¡¤È¤·¤Æ
-.I buf
-¤ò»ØÄꤷ¡¢¥Ð¥Ã¥Õ¥¡¤Î»ØÄê»þ¤Ë¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤ò
-stdio ¤Ë¶µ¤¨¤ëÊýË¡¤¬¤¢¤ë¡£)
 .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1995
 .\" and
 .\" http://sources.redhat.com/ml/libc-alpha/2006-04/msg00064.html
+バッファに \fIsize\fP バイトよりたくさん書き込もうとした場合には、エラーとなる。 (デフォルトでは、このようなエラーが見えるのは \fIstdio\fP
+バッファがフラッシュされた時だけである。 \fIsetbuf(fp,\ NULL)\fP を使ってバッファリングを無効にする方法は、
+出力操作を行った時点でエラーを検出するのに役立つ。 別の方法としては、 \fIsetbuffer(fp, buf, size)\fP
+を使って、呼び出し側が明示的に stdio ストリームバッファとして \fIbuf\fP を指定し、バッファの指定時にバッファのサイズを stdio
+に教える方法がある。)
 .PP
-.\"O In a stream opened for reading,
-.\"O null bytes (\(aq\\0\(aq) in the buffer do not cause read
-.\"O operations to return an end-of-file indication.
-.\"O A read from the buffer will only indicate end-of-file
-.\"O when the file pointer advances
-.\"O .I size
-.\"O bytes past the start of the buffer.
-Æɤ߽Ф·ÍѤ˥ª¡¼¥×¥ó¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤Ç¤Ï¡¢
-¥Ð¥Ã¥Õ¥¡Æâ¤Ë NULL ¥Ð¥¤¥È (\(aq\\0\(aq) ¤¬¤¢¤Ã¤Æ¤â
-Æɤ߽Ф·Áàºî¤¬¥Õ¥¡¥¤¥ëËöÈø (end-of-file) ¤òÊÖ¤¹¤³¤È¤Ï¤Ê¤¤¡£
-¥Ð¥Ã¥Õ¥¡¤«¤é¤ÎÆɤ߽Ф·¤Ç¥Õ¥¡¥¤¥ëËöÈø¤¬ÊÖ¤ë¤Î¤Ï¡¢
-¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤¬¥Ð¥Ã¥Õ¥¡¤ÎÀèƬ¤«¤é
-.I size
-¥Ð¥¤¥È¤ò±Û¤¨¤ÆÀè¤Ë¿Ê¤â¤¦¤È¤·¤¿¾ì¹ç¤À¤±¤Ç¤¢¤ë¡£
+読み出し用にオープンされたストリームでは、 バッファ内に NULL バイト (\(aq\e0\(aq) があっても 読み出し操作がファイル末尾
+(end\-of\-file) を返すことはない。 バッファからの読み出しでファイル末尾が返るのは、 ファイルポインタがバッファの先頭から \fIsize\fP
+バイトを越えて先に進もうとした場合だけである。
 .PP
-.\"O If
-.\"O .I buf
-.\"O is specified as NULL, then
-.\"O .BR fmemopen ()
-.\"O dynamically allocates a buffer
-.\"O .I size
-.\"O bytes long.
-.I buf
-¤Ë NULL ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
-.BR fmemopen ()
-¤ÏưŪ¤Ë
-.I size
-¥Ð¥¤¥È¤ÎŤµ¤Î¥Ð¥Ã¥Õ¥¡¤ò³ÎÊݤ¹¤ë¡£
-.\"O This is useful for an application that wants to write data to
-.\"O a temporary buffer and then read it back again.
-.\"O The buffer is automatically freed when the stream is closed.
-.\"O Note that the caller has no way to obtain a pointer to the
-.\"O temporary buffer allocated by this call (but see
-.\"O .BR open_memstream ()
-.\"O below).
-¤³¤ÎÊýË¡¤Ï¡¢°ì»þ¥Ð¥Ã¥Õ¥¡¤Ë¥Ç¡¼¥¿¤Î½ñ¤­¹þ¤ß¤ò¹Ô¤Ã¤Æ¤«¤é¡¢
-¤½¤ÎÆâÍƤòºÆÅÙÆɤ߽Ф¹¤è¤¦¤Ê¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÇÍ­ÍѤǤ¢¤ë¡£
-¤³¤Î¥Ð¥Ã¥Õ¥¡¤Ï¥¹¥È¥ê¡¼¥à¤¬¥¯¥í¡¼¥º¤µ¤ì¤ë¤È¤­¤Ë¼«Æ°Åª¤Ë²òÊü¤µ¤ì¤ë¡£
-¸Æ¤Ó½Ð¤·¸µ¤«¤é¤Ï¤³¤Î´Ø¿ô¤¬³ä¤êÅö¤Æ¤¿°ì»þ¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ý¥¤¥ó¥¿Ãͤò
-ÃΤëÊýË¡¤Ï¸ºß¤·¤Ê¤¤ÅÀ¤ËÃí°Õ (²¼µ­¤Î
-.BR open_memstream ()
-¤â»²¾È)¡£
-
-.\"O The
-.\"O .BR open_memstream ()
-.\"O function opens a stream for writing to a buffer.
-.\"O The buffer
-.\"O is dynamically allocated (as with
-.\"O .BR malloc (3)),
-.\"O and automatically grows as required.
-.\"O After closing the stream, the caller should
-.\"O .BR free (3)
-.\"O this buffer.
-.BR open_memstream ()
-´Ø¿ô¤Ï¡¢¥Ð¥Ã¥Õ¥¡¤Ø¤Î½ñ¤­¹þ¤ßÍѤ˥¹¥È¥ê¡¼¥à¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£
-¥Ð¥Ã¥Õ¥¡¤Ï
-.RB ( malloc (3)
-¤ò»È¤Ã¤Æ) Æ°Åª¤Ë³ä¤êÅö¤Æ¤é¤ì¡¢É¬Íפ˱þ¤¸¤Æ¼«Æ°Åª¤Ë¿­Ä¹¤¹¤ë¡£
-¥¹¥È¥ê¡¼¥à¤ò¥¯¥í¡¼¥º¤·¤¿¸å¤Ç¡¢¸Æ¤Ó½Ð¤·¸µ¤Ï¤³¤Î¥Ð¥Ã¥Õ¥¡¤ò
-.BR free (3)
-¤¹¤Ù¤­¤Ç¤¢¤ë¡£
-
-.\"O When the stream is closed
-.\"O .RB ( fclose (3))
-.\"O or flushed
-.\"O .RB ( fflush (3)),
-.\"O the locations pointed to by
-.\"O .I ptr
-.\"O and
-.\"O .I sizeloc
-.\"O are updated to contain, respectively, a pointer to the buffer and the
-.\"O current size of the buffer.
-.\"O These values remain valid only as long as the caller
-.\"O performs no further output on the stream.
-.\"O If further output is performed, then the stream
-.\"O must again be flushed before trying to access these variables.
-¤³¤Î¥¹¥È¥ê¡¼¥à¤¬
-¥¯¥í¡¼¥º
-.RB ( fclose (3))
-¤µ¤ì¤¿¤ê¥Õ¥é¥Ã¥·¥å
-.RB ( fflush (3))
-¤µ¤ì¤¿»þ¤Ë¡¢
-.I ptr
-¤È
-.I sizeloc
-¤ÎÃͤϤ½¤ì¤¾¤ì¥Ð¥Ã¥Õ¥¡¤Ø¤Î¥Ý¥¤¥ó¥¿¤È¤½¤Î¥µ¥¤¥º¤Ë¹¹¿·¤µ¤ì¤ë¡£
-¤³¤ì¤é¤ÎÃͤϡ¢¸Æ¤Ó½Ð¤·¸µ¤¬¤½¤Î¥¹¥È¥ê¡¼¥à¤Ë¿·¤¿¤Ê½ñ¤­¹þ¤ß¤ò
-¹Ô¤ï¤Ê¤¤¾ì¹ç¤Ë¸Â¤êÍ­¸ú¤Ç¤¢¤ë¡£
-¥¹¥È¥ê¡¼¥à¤Ë½ñ¤­¹þ¤ß¤ò¹Ô¤Ã¤¿ºÝ¤Ë¤Ï¡¢¤³¤ì¤é¤ÎÊÑ¿ô¤ò»²¾È¤¹¤ëÁ°¤Ë
-¥¹¥È¥ê¡¼¥à¤òºÆÅÙ¥Õ¥é¥Ã¥·¥å¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
-
-.\"O A null byte is maintained at the end of the buffer.
-.\"O This byte is
-.\"O .I not
-.\"O included in the size value stored at
-.\"O .IR sizeloc .
-¥Ð¥Ã¥Õ¥¡ËöÈø¤Î NULL ¥Ð¥¤¥È¤ÏÊÝ»ý¤µ¤ì¤ë¡£
-¤³¤Î NULL ¥Ð¥¤¥È¤Ï
-.I sizeloc
-¤Ë³ÊǼ¤µ¤ì¤ë¥µ¥¤¥º¤Ë¤Ï¡Ö´Þ¤Þ¤ì¤Ê¤¤¡×¡£
-
-.\"O The stream's file position can be changed with
-.\"O .BR fseek (3)
-.\"O or
-.\"O .BR fseeko (3).
-.\"O Moving the file position past the end
-.\"O of the data already written fills the intervening space with
-.\"O zeros.
-¥¹¥È¥ê¡¼¥à¤Î¥Õ¥¡¥¤¥ë°ÌÃÖ¤Ï
-.BR fseek (3)
-¤ä
-.BR fseeko (3)
-¤ÇÊѹ¹¤Ç¤­¤ë¡£
-¤¹¤Ç¤Ë¥Ç¡¼¥¿¤¬½ñ¤­¹þ¤Þ¤ì¤¿Îΰè¤ÎËöÈø¤è¤êÀè¤Ë¥Õ¥¡¥¤¥ë°ÌÃÖ¤òÆ°¤«¤¹¤È¡¢
-¤½¤Î´Ö¤ÎÎΰè¤Ï 0 ¤ÇËä¤á¤é¤ì¤ë¡£
-
-.\"O The
-.\"O .BR open_wmemstream ()
-.\"O is similar to
-.\"O .BR open_memstream (),
-.\"O but operates on wide characters instead of bytes.
-.BR open_wmemstream ()
-¤Ï
-.BR open_memstream ()
-¤ÈƱÍͤÀ¤¬¡¢¥Ð¥¤¥È¤Ç¤Ï¤Ê¤¯¥ï¥¤¥Éʸ»ú¤ËÂФ·¤ÆÁàºî¤ò¹Ô¤¦ÅÀ¤¬°Û¤Ê¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O Upon successful completion
-.\"O .BR fmemopen (),
-.\"O .BR open_memstream ()
-.\"O and
-.\"O .BR open_wmemstream ()
-.\"O return a
-.\"O .I FILE
-.\"O pointer.
-.\"O Otherwise, NULL is returned and
-.\"O .I errno
-.\"O is set to indicate the error.
-À®¸ù¤·¤Æ½ªÎ»¤·¤¿¾ì¹ç¤Ë¤Ï¡¢
-.BR fmemopen (),
-.BR open_memstream (),
-.BR open_wmemstream ()
-¤Ï
-.I FILE
-¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
-¼ºÇÔ¤·¤¿¾ì¹ç¤Ï¡¢ NULL ¤òÊÖ¤·¡¢
-.I errno
-¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤò¥»¥Ã¥È¤¹¤ë¡£
-.\"O .SH VERSIONS
-.SH ¥Ð¡¼¥¸¥ç¥ó
-.\"O .BR fmemopen ()
-.\"O and
-.\"O .BR open_memstream ()
-.\"O were already available in glibc 1.0.x.
-.\"O .BR open_wmemstream ()
-.\"O is available since glibc 2.4.
-.BR fmemopen ()
-¤È
-.BR open_memstream ()
-¤Ï glibc 1.0.x ¤Ç¤¹¤Ç¤ËÍøÍѲÄǽ¤Ç¤¢¤Ã¤¿¡£
-.BR open_wmemstream ()
-¤Ï glibc 2.4 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-POSIX.1-2008.
-.\"O These functions are not specified in POSIX.1-2001,
-.\"O and are not widely available on other systems.
-¤³¤ì¤é¤Î´Ø¿ô¤Ï POSIX.1-2001 ¤Ç¤Ïµ¬Äê¤ì¤Æ¤¤¤Ê¤¤¤¬¡¢
-Linux °Ê³°¤Î¥·¥¹¥Æ¥à¤Ç¹­¤¯ÍøÍѲÄǽ¤Ç¤¢¤ë¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O There is no file descriptor associated with the file stream
-.\"O returned by these functions
-.\"O (i.e.,
-.\"O .BR fileno (3)
-.\"O will return an error if called on the returned stream).
-¤³¤ì¤é¤Î´Ø¿ô¤¬ÊÖ¤¹¥Õ¥¡¥¤¥ë¥¹¥È¥ê¡¼¥à¤ËÂбþ¤¹¤ë¥Õ¥¡¥¤¥ë
-¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¤Ê¤¤ (¤Ä¤Þ¤ê¡¢ÊÖ¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ
-.BR fileno (3)
-¤ò¸Æ¤Ó½Ð¤¹¤È¥¨¥é¡¼¤¬Ê֤뤳¤È¤Ë¤Ê¤ë)¡£
-.\"O .SH BUGS
-.SH ¥Ð¥°
-.\"O In glibc before version 2.7, seeking past the end of a stream created by
-.\"O .BR open_memstream ()
-.\"O does not enlarge the buffer; instead the
-.\"O .BR fseek ()
-.\"O call fails, returning \-1.
-.\"O .\" http://sourceware.org/bugzilla/show_bug.cgi?id=1996
-¥Ð¡¼¥¸¥ç¥ó 2.7 ¤è¤êÁ°¤Î glibc ¤Ç¤Ï¡¢
-.BR open_memstream ()
-¤ÇºîÀ®¤µ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ÎËöÈø¤è¤êÀè¤Ë¥Õ¥¡¥¤¥ë°ÌÃÖ¤òÆ°¤«¤·¤Æ¤â¡¢
-¥Ð¥Ã¥Õ¥¡¤¬¿­Ä¹¤µ¤ì¤º¡¢
-.BR fseek ()
-¤¬¼ºÇÔ¤· \-1 ¤¬Ê֤롣
+\fIbuf\fP に NULL が指定された場合、 \fBfmemopen\fP()  は動的に \fIsize\fP バイトの長さのバッファを確保する。
+この方法は、一時バッファにデータの書き込みを行ってから、 その内容を再度読み出すようなアプリケーションで有用である。
+このバッファはストリームがクローズされるときに自動的に解放される。 呼び出し元からはこの関数が割り当てた一時バッファへのポインタ値を
+知る方法は存在しない点に注意 (下記の \fBopen_memstream\fP()  も参照)。
+
+\fBopen_memstream\fP()  関数は、バッファへの書き込み用にストリームをオープンする。 バッファは (\fBmalloc\fP(3)
+を使って) 動的に割り当てられ、必要に応じて自動的に伸長する。 ストリームをクローズした後で、呼び出し元はこのバッファを \fBfree\fP(3)
+すべきである。
+
+このストリームが クローズ (\fBfclose\fP(3))  されたりフラッシュ (\fBfflush\fP(3))  された時に、 \fIptr\fP と
+\fIsizeloc\fP の値はそれぞれバッファへのポインタとそのサイズに更新される。 これらの値は、呼び出し元がそのストリームに新たな書き込みを
+行わない場合に限り有効である。 ストリームに書き込みを行った際には、これらの変数を参照する前に ストリームを再度フラッシュしなければならない。
+
+バッファ末尾の NULL バイトは保持される。 この NULL バイトは \fIsizeloc\fP に格納されるサイズには「含まれない」。
+
+ストリームのファイル位置は \fBfseek\fP(3)  や \fBfseeko\fP(3)  で変更できる。
+すでにデータが書き込まれた領域の末尾より先にファイル位置を動かすと、 その間の領域は 0 で埋められる。
+
+\fBopen_wmemstream\fP()  は \fBopen_memstream\fP()
+と同様だが、バイトではなくワイド文字に対して操作を行う点が異なる。
+.SH 返り値
+成功して終了した場合には、 \fBfmemopen\fP(), \fBopen_memstream\fP(), \fBopen_wmemstream\fP()  は
+\fIFILE\fP ポインタを返す。 失敗した場合は、 NULL を返し、 \fIerrno\fP にエラーを示す値をセットする。
+.SH バージョン
+\fBfmemopen\fP()  と \fBopen_memstream\fP()  は glibc 1.0.x ですでに利用可能であった。
+\fBopen_wmemstream\fP()  は glibc 2.4 以降で利用可能である。
+.SH 準拠
+POSIX.1\-2008.  これらの関数は POSIX.1\-2001 では規定れていないが、 Linux 以外のシステムで広く利用可能である。
+
+.\" http://austingroupbugs.net/view.php?id=396
+POSIX.1\-2008 では \fImode\fP の \(aqb\(aq は無視されるべきだと規定されて
+いる。一方、Technical Corrigendum (正誤表) 1 では、\fImode\fP の
+\(aqb\(aq が指定された場合の扱いは実装依存であることを許容するように
+標準規格が修正されており、glibc の \(aqb\(aq の扱いは許されている。
+.SH 注意
+これらの関数が返すファイルストリームに対応するファイル ディスクリプタはない (つまり、返されたストリームに対して \fBfileno\fP(3)
+を呼び出すとエラーが返ることになる)。
+.SH バグ
 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=1996
-.\"O .SH "EXAMPLE"
-.SH Îã
-.\"O The program below uses
-.\"O .BR fmemopen ()
-.\"O to open an input buffer, and
-.\"O .BR open_memstream ()
-.\"O to open a dynamically sized output buffer.
-.\"O The program scans its input string (taken from the program's
-.\"O first command-line argument) reading integers,
-.\"O and writes the squares of these integers to the output buffer.
-.\"O An example of the output produced by this program is the following:
-¤³¤Î¥×¥í¥°¥é¥à¤Ï
-.BR fmemopen ()
-¤ò»È¤Ã¤Æ½ÐÎϥХåե¡¤ò¥ª¡¼¥×¥ó¤·¡¢
-.BR open_memstream ()
-¤ò»È¤Ã¤ÆưŪ¤Ë¥µ¥¤¥º¤¬ÊѲ½¤¹¤ë½ÐÎϥХåե¡¤ò¥ª¡¼¥×¥ó¤·¤Æ¤¤¤ë¡£
-(¥×¥í¥°¥é¥à¤ÎÂè°ì¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤«¤é¼è¤Ã¤¿) ÆþÎÏʸ»úÎó¤ò
-¥¹¥­¥ã¥ó¤·¤ÆÀ°¿ô¤òÆɤ߹þ¤ß¡¢¤³¤ì¤é¤ÎÀ°¿ô¤ÎÆó¾è¤ò½ÐÎϥХåե¡¤Ë½ñ¤­½Ð¤¹¡£
-¤³¤Î¥×¥í¥°¥é¥à¤Î¼Â¹ÔÎã¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
+バージョン 2.7 より前の glibc では、 \fBopen_memstream\fP()
+で作成されたストリームの末尾より先にファイル位置を動かしても、 バッファが伸長されず、 \fBfseek\fP(3)  が失敗し \-1 が返る。
+
+.\" FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=11216
+\fIsize\fP に 0 が指定された場合、 \fBfmemopen\fP() はエラー \fBEINVAL\fP で失敗
+する。この場合にはストリームの作成に成功して、最初の読み出しを行った際に
+EOF (end of file) が返される方が、ストリームの扱いの一貫性が増すだろう。
+また、 POSIX.1\-2008 ではこの場合のエラーは規定されていない。
+
+.\" FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=13152
+\fBfmemopen\fP() に追記モード ("a" や "a+") を指定すると、
+ファイル位置の初期値は最初の NULL バイトに設定されるが、(ファイル
+オフセットをストリームの末尾以外の位置に再設定した場合)それ以降の
+書き込みではストリームの末尾への追記が行われる訳ではない。
+
+.\" FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=13151
+\fBfmemopen\fP() の \fImode\fP 引き数に追記モード ("a" や "a+") を指定し、
+\fIsize\fP 引き数で指定した範囲の \fIbuf\fP 内に NULL バイトがない場合、
+POSIX.1\-2008 では、ファイル位置の初期値はバッファの末尾の直後の
+バイトに設定すべきとされている。しかし、glibc の \fBfmemopen\fP() では
+この場合ファイル位置は \-1 に設定される。
+
+.\" FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=12836
+\fBfmemopen\fP() でバイナリモードを指定するには、
+\(aqb\(aq は \fImode\fP の \fI2 文字目\fP でなければならない。
+例えば、 "wb+" は意図通りの効果になるが、 "w+b" はそうではない。
+これは \fBfopen\fP(3) の \fImode\fP の扱いとは異なる。
+
+.\" http://sourceware.org/bugzilla/show_bug.cgi?id=6544
+glibc 2.9 での \fBfmemopen\fP() の「バイナリ」モードの追加は、
+ABI (Application Binary Interface) が黙って変更された。
+それ以前の \fBfmemopen\fP() では \fImode\fP 内の \(aqb\(aq は無視されていた。
+.SH 例
+このプログラムは \fBfmemopen\fP()  を使って出力バッファをオープンし、 \fBopen_memstream\fP()
+を使って動的にサイズが変化する出力バッファをオープンしている。 (プログラムの第一コマンドライン引き数から取った) 入力文字列を
+スキャンして整数を読み込み、これらの整数の二乗を出力バッファに書き出す。 このプログラムの実行例は以下のようになる。
 .in +4n
 .nf
 
-.RB "$" " ./a.out \(aq1 23 43\(aq"
+$\fB ./a.out \(aq1 23 43\(aq\fP
 size=11; ptr=1 529 1849
 .fi
 .in
-.\"O .SS Program source
-.SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹
+.SS プログラムのソース
 \&
 .nf
 #define _GNU_SOURCE
@@ -405,7 +177,7 @@ size=11; ptr=1 529 1849
 #include <stdio.h>
 #include <stdlib.h>
 
-#define handle_error(msg) \\
+#define handle_error(msg) \e
     do { perror(msg); exit(EXIT_FAILURE); } while (0)
 
 int
@@ -417,7 +189,7 @@ main(int argc, char *argv[])
     char *ptr;
 
     if (argc != 2) {
-       fprintf(stderr, "Usage: %s <file>\\n", argv[0]);
+       fprintf(stderr, "Usage: %s <file>\en", argv[0]);
        exit(EXIT_FAILURE);
     }
 
@@ -440,13 +212,14 @@ main(int argc, char *argv[])
     }
     fclose(in);
     fclose(out);
-    printf("size=%ld; ptr=%s\\n", (long) size, ptr);
+    printf("size=%ld; ptr=%s\en", (long) size, ptr);
     free(ptr);
     exit(EXIT_SUCCESS);
 }
 .fi
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR fopen (3),
-.BR fopencookie (3),
-.BR feature_test_macros (7)
+.SH 関連項目
+\fBfopen\fP(3), \fBfopencookie\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。