This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: fmemopen
- From: Roland McGrath <roland at redhat dot com>
- To: bkorb at veritas dot com
- Cc: libc-alpha at sources dot redhat dot com
- Date: Tue, 8 Mar 2005 21:17:06 -0800
- Subject: Re: fmemopen
> 1. I wanted it to work on BSD systems which do not have fopencookie.
> They have funopen, which is completely equivalent.
If you want something portable, then you should not assume you can diddle
with the stdio buffer directly at all.
> 2. the "output" area should be extensible instead of requiring
> a presupposed maximum size
Use open_memstream.
> 3. It ought to be possible to obtain the current buffer address
> without requiring that the client allocate stable storage for
> the information. The client need only track the FILE* pointer.
This is outside the scope of the cookie-style interface, which explicitly
knows nothing about stdio internals like its buffers.
> 4. The original implementation assumed the buffer had to be a
> NUL terminated string. I assume binary data if the "b" flag
> is in the open mode string.
There is no content constraint on open_memstream's streams.