Define your own custom conversion specifiers for printf.

In this example we define two specifiers: %P, %W.
%P -> prints IPv4 address from struct in_addr.
%W -> prints IPv6 address from struct in6_addr.

Example code: ( The GNU C Library only. )

Leave a Reply