customizing scanf ?

Carlos O'Donell carlos@systemhalted.org
Sun Oct 11 14:09:59 GMT 2026


On Fri, Oct 9, 2026 at 3:38 PM Basile STARYNKEVITCH
<basile@starynkevitch.net> wrote:
> With GNU libc, its printf and fprintf can be customized, see
> https://sourceware.org/glibc/manual/latest/html_node/Customizing-Printf.html
>
> Is there any analogue facilities to customize scanf?

No. There is no facility to customize scanf.

> (or do you know about any open source software adding customization for
> scanf)

There are many reasons why scanf is not implemented.

Firstly in order to implement a custom scanf handler we would have to
rearchitect the vfscanf internals to expose quite a large API surface
to allow forward scanning of the buffer, push back, and several other
models for allowing the specifier to match input.

This is quite an undertaking and would create a frozen ABI that would
limit how glibc could implement scanf internally.

Overall the project conisders these hooks a costly feature to continue
to support and so we're often looking for ways to avoid adding further
versions of these.

> NB: my open source project is an inference engine, see refpersys.org

What would the be the case for adding this hook? Can you achieve the
same thing with a wrapper that interposes the function?

Cheers,
Carlos.


More information about the Libc-help mailing list