How to predict size of outcome of vsprintf?

Chris Torek chris at mimsy.UUCP
Wed Mar 22 20:53:47 AEST 1989


In article <wY9m4Hy00UkaI=3Ihb at andrew.cmu.edu> bader+ at andrew.cmu.edu
(Miles Bader) writes:
>What I'd really like would be a new function that could act as a basis
>for all the other printf functions, and make it possible to emulate
>them in nice ways.
>
>I would make it a varargs function that takes a bounded output buffer
>and is restartable at the point where it stops due to running into the
>end of the buffer.

This is fairly difficult to implement (one wants coroutines for something
like this).  Instead, why not allow stdio streams to `read' and `write'
via user-provided functions?  Everyone knows how to use read() and
write(); simply provide your own write() that mallocs space, or prints
in a window, or whatever.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list