/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_ptrs.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/27 10:13:07 by narnaud #+# #+# */ /* Updated: 2023/04/13 12:12:31 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_printf.h" void ft_print_ptr(void *ptr, t_opts *opts) { char *raw; char *nbr; if (ptr == NULL) raw = ft_strdup("0x0"); else { raw = ft_itox((unsigned long long int)ptr, "0123456789abcdef"); raw = ft_append(ft_strdup("0x"), raw); } nbr = ptr_opts_transform(raw, opts); opts->dot = 0; ft_print_str(nbr, opts); free(raw); free(nbr); } void va_print_ptr(va_list va_ptr, t_opts *opts) { ft_print_ptr(va_arg(va_ptr, void *), opts); }