-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_putunbr_fd.c
25 lines (22 loc) · 1.1 KB
/
ft_putunbr_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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_putunbr_fd.c :+: :+: */
/* +:+ */
/* By: jaberkro <[email protected]> +#+ */
/* +#+ */
/* Created: 2021/11/29 12:45:59 by jaberkro #+# #+# */
/* Updated: 2022/01/04 13:54:53 by Jorien ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_putunbr_fd(unsigned int n, int fd)
{
int out;
out = 0;
if (n == 0)
return (write(fd, "0", 1));
else if (n > 9)
out += ft_putunbr_fd(n / 10, fd);
return (out + ft_putchar_fd((n % 10) + 48, fd));
}