/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putnbr_fd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: thrieg +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/15 17:44:20 by thrieg #+# #+# */ /* Updated: 2025/02/16 19:04:23 by thrieg ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" static unsigned int ft_abs(int a) { if (a < 0) return (-a); return (a); } void ft_putnbr_fd(int n, int fd) { if (n < 0) ft_putchar_fd('-', fd); if (ft_abs(n) < 10) ft_putchar_fd(ft_abs(n) + '0', fd); else { ft_putnbr_fd(ft_abs(n / 10), fd); ft_putnbr_fd(ft_abs(n % 10), fd); } }