Re: send_to_charf, Take 2

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 07/11/01


"Daniel A. Koepke" wrote:
>
> Anyway, it only works for printf() (and _maybe_
> fprintf()?).

Hrmmm, are you sure of this?  The info page mentions that it works for
"`printf' and friends".  I would include any *printf() function to fall
into that category.

>  It's incompatability with sprintf() (and associates) is
> guranteed by the fact that the registered specifier handler takes a FILE
> pointer argument and is expected to write the converted data there.

That guarantees nothing, sprintf() uses streams internally with the
string streams mechanism as this quote from the libc info page shows:

        One such type of stream takes input from or writes output to a
        string.  These kinds of streams are used internally to implement the
        `sprintf' and `sscanf' functions.  You can also create such a stream
        explicitly, using the functions described in *Note String Streams::.

i.e., sprintf() actually uses streams and probably gets it's output
almost directly from fprintf() itself.  So, if fprintf() works, so
should sprintf().

> IOW, it would be of no use for something like send_to_charf().

Again, are you quite ceartain?

Regards, Peter

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST