-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr_fd.c
30 lines (27 loc) · 1.07 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
29
30
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_putnbr_fd.c :+: :+: */
/* +:+ */
/* By: rvan-mee <rvan-mee@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2022/03/05 13:12:36 by rvan-mee #+# #+# */
/* Updated: 2022/03/05 13:12:37 by rvan-mee ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int n, int fd)
{
long i;
i = n;
if (i < 0)
{
i *= -1;
write(fd, "-", 1);
}
if (i > 9)
ft_putnbr_fd(i / 10, fd);
i %= 10;
i += 48;
write(fd, &i, 1);
}