-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_putnbr_fd.c
38 lines (33 loc) · 1.21 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
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putnbr_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: xle-boul <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/05 12:47:22 by xle-boul #+# #+# */
/* Updated: 2021/10/12 15:25:04 by xle-boul ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* putnbr but chose on which file descriptor it is printed */
void ft_putnbr_fd(int n, int fd)
{
unsigned int nb;
if (n < 0)
{
ft_putchar_fd('-', fd);
n *= -1;
}
nb = n;
if (nb >= 10)
ft_putnbr_fd(nb / 10, fd);
ft_putchar_fd(nb % 10 + 48, fd);
}
/*
int main()
{
ft_putnbr_fd(-2147483648, 1);
return 0;
}
*/