This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: fmemopen
- From: Bruce Korb <bkorb at veritas dot com>
- To: Roland McGrath <roland at redhat dot com>, libc-alpha at sources dot redhat dot com
- Date: Tue, 08 Mar 2005 06:50:08 -0800
- Subject: Re: fmemopen
- References: <200503080408.j2848dRV002878@magilla.sf.frob.com>
- Reply-to: bkorb at veritas dot com
Roland McGrath wrote:
>
> It's pretty hard to figure out what you really want.
> You seem to fundamentally misunderstand what fmemopen does.
Sorry if I was unclear. I do, indeed, understand what it does.
It did not do quite what I needed, so I rewrote it to do so
on top of either fopencookie (GNU) or on top of funopen (BSD).
I would like it to be able to behave exactly as the current
version behaves, but to switch between behaviors I would need
to tell it to behave one way or another. How do you do that?
You can't. Leastwise, not very well. I know I can recast the
"FILE*" pointer into the specialized structure that contains
the cookie, but that structure belongs to the fopencookie code
and is not exported. "fcookie" (or whatever you might want to
call it) would be the "method" for obtaining the cookie from the
FILE* pointer. Another mechanism might be "fcookieioctl" (or
another name). Or, finally, overloading "fseek" and allowing
through non-standard direction codes. (unclean, but it would
work.)