STDIO (Re: TRUE and FALSE)

Stephen P Spackman stephen at estragon.uchicago.edu
Sat Sep 8 03:50:34 AEST 1990


In article <38Q5QG2 at xds13.ferranti.com> peter at ficc.ferranti.com (Peter da Silva) writes:
   For that matter, the whole stdio suite is fubar. But, it's a standard.
   Perhaps a new library could be designed in alt.lang.cfutures
   [...]

Another thing that is needed is a function
   FILE *pseudof
     ( int (*producer)(void *handle, char *buf, size_t len)
     , int (*consumer)(void *handle, char const *buf, size_t len)
     , void *handle
     , char const *mode
     );

that takes USER-DEFINED buffer readers and writers and makes a "FILE"
object. That way, you gat all the sprintf analogues for free, and you
can fake up portable I/O for nonstandard filesystems and all sorts of
groovy stuff.

That signature needs further thought - maybe it needs a flush/close
function as well, e.g.; but it's not so far away.

stephen p spackman  stephen at estragon.uchicago.edu  312.702.3982



More information about the Comp.lang.c mailing list