/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_conv_ith.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lfirmin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/19 04:46:47 by lfirmin #+# #+# */ /* Updated: 2024/06/19 07:46:23 by lfirmin ### ########.fr */ /* */ /* ************************************************************************** */ #include "ftprintf.h" void ft_conv_ith(int fd, unsigned int nbr, const char str) { if (nbr >= 16) { ft_conv_ith(fd, (nbr / 16), str); nbr = nbr % 16; } if (nbr <= 9) ft_putchar(fd, nbr + '0'); else { if (str == 'x') ft_putchar(fd, nbr - 10 + 'a'); else if (str == 'X') ft_putchar(fd, nbr - 10 + 'A'); } }