31 lines
1.2 KiB
C
31 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* print_pointer_bonus.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/11/17 12:19:16 by dgaillet #+# #+# */
|
|
/* Updated: 2025/11/19 20:16:31 by dgaillet ### ########lyon.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
#include "ft_printf_bonus.h"
|
|
|
|
int print_pointer(t_arg *arg, unsigned long long p)
|
|
{
|
|
int count;
|
|
|
|
count = 0;
|
|
if (!p)
|
|
{
|
|
ft_putstr_fd("(nil)", 1);
|
|
return (5);
|
|
}
|
|
if (arg->arg)
|
|
ft_putstr_fd("", 1);
|
|
count += write(1, "0x", 2);
|
|
return (count + ft_putnbr_base(p, "0123456789abcdef", 16));
|
|
}
|