-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_putnbrbase_fd.c
31 lines (28 loc) · 1.3 KB
/
ft_putnbrbase_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_putnbrbase_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rlambert <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/26 16:56:41 by rlambert #+# #+# */
/* Updated: 2015/01/28 16:14:55 by rlambert ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include "libft.h"
static void ft_putnbrbase_fd_inner(uintmax_t nbr, char *base, size_t baselen,
int fd)
{
if (nbr >= baselen)
{
ft_putnbrbase_fd_inner(nbr / baselen, base, baselen, fd);
ft_putnbrbase_fd_inner(nbr % baselen, base, baselen, fd);
}
else
ft_putchar_fd(base[nbr], fd);
}
void ft_putnbrbase_fd(uintmax_t nbr, char *base, int fd)
{
ft_putnbrbase_fd_inner(nbr, base, ft_strlen(base), fd);
}