diff options
Diffstat (limited to 'convert_ptr.c')
| -rw-r--r-- | convert_ptr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/convert_ptr.c b/convert_ptr.c new file mode 100644 index 0000000..c74222c --- /dev/null +++ b/convert_ptr.c @@ -0,0 +1,22 @@ +#include <stdarg.h> +#include "header.h" + +char *convert_ptr(va_list ap, t_pformat *pformat) +{ + char *str = ITOA_HEX_LOW(va_arg(ap, void*)); + + str = handle_precision(pformat, str); + str = add_hex_prefix(str); + str = handle_padding(pformat, str); + return (str); +} + +char *add_hex_prefix(char *str) +{ + char *tmp; + + if ((tmp = ft_strjoin("0x", str)) == NULL) + return (NULL); + free(str); + return (tmp); +} |
