aboutsummaryrefslogtreecommitdiff
path: root/ft_putnbr_fd.c
blob: c49de564bee963b0f7559907fbd173cc9e48885d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <unistd.h>
#include "libft.h"

void ft_putnbr_fd(int n, int fd)
{
	unsigned int	p_n;

	p_n = n;
	if (n < 0)
	{
        ft_putchar_fd('-', fd);
		p_n = -n;
	}
	if (p_n > 9)
		ft_putnbr_fd(p_n / 10, fd);
	ft_putchar_fd(p_n % 10 + '0', fd);
}