Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: designing a filter interface for FILE* Date: Wed, 02 Nov 2016 09:38:27 -0700 Organization: None to speak of Lines: 24 Message-ID: References: <6314f428-19b2-4ac4-9a39-7e5c2c98203e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="55d562a779fc0ae2b1f2a983cf45db85"; logging-data="30201"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WDwJb5U1asZDvQEE4/TQw" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:W0bJ5z53KHpA+6NZ+p9TKC87EpI= sha1:fQNPOG6VFBazxV8QgEm3uKd18I8= Xref: csiph.com comp.lang.c:95599 luser droog writes: > Two distinct feature-requests have conspired to produce > a requirement for my application (postscript interpreter > library) to support /interfaced/ FILE objects. So I'm > following my usual course: a public brainstorm. > > So I need to make in internal `struct file` type with > variant subtypes, and `my_read()` and `my_write()` functions > which use `getchar()` and `putchar()` only on real FILE* > variants. > > I also need a "mock file" which is backed by a counted > string. [snip] If you're able to assume POSIX support, take a look at fmemopen(). If you have further questions about fmemopen(), I suggest comp.unix.programmer. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"