33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_putnbr_fd.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: pbonilla <eirodeis.lepnj@gmail.com> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2020/12/01 17:58:34 by pbonilla #+# #+# */
|
|
/* Updated: 2020/12/01 18:25:48 by pbonilla ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void ft_putnbr_fd(int n, int fd)
|
|
{
|
|
long nb;
|
|
|
|
nb = n;
|
|
if (nb < 0)
|
|
{
|
|
ft_putchar_fd('-', fd);
|
|
nb = -nb;
|
|
}
|
|
if (nb >= 10)
|
|
{
|
|
ft_putnbr_fd(nb / 10, fd);
|
|
ft_putnbr_fd(nb % 10, fd);
|
|
}
|
|
else
|
|
ft_putchar_fd(nb + '0', fd);
|
|
}
|