-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr_fd.c
28 lines (25 loc) · 1.1 KB
/
ft_putnbr_fd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: juchoi <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/01/21 16:02:34 by juchoi #+# #+# */
/* Updated: 2021/01/23 11:22:38 by juchoi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int n, int fd)
{
long long ln;
ln = (long long)n;
if (n < 0)
{
ln = -1 * ln;
write(fd, "-", 1);
}
if (ln >= 10)
ft_putnbr_fd((ln / 10), fd);
ft_putchar_fd((ln % 10) + '0', fd);
}