-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putnbr_fd.c
31 lines (28 loc) · 1.11 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
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bhagenlo <[email protected]. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/28 19:07:42 by bhagenlo #+# #+# */
/* Updated: 2022/04/05 14:54:10 by bhagenlo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_putnbr_fd(int n, int fd)
{
long num;
char c;
num = n;
c = 0;
if (num < 0)
{
write(fd, "-", 1);
num = -num;
}
if (num / 10 > 0)
ft_putnbr_fd(num / 10, fd);
c = num % 10 + '0';
write(fd, &c, 1);
}