35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_dprintl_base.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2022/10/10 03:26:21 by cchauvet #+# #+# */
|
|
/* Updated: 2023/02/17 16:30:25 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "ft_printf.h"
|
|
|
|
int ft_dprintl_base(int fd, long long int n, char *base)
|
|
{
|
|
int i;
|
|
unsigned long nb;
|
|
|
|
if (base == NULL)
|
|
return (-1);
|
|
i = 0;
|
|
if (n < 0)
|
|
{
|
|
nb = -n;
|
|
i += ft_putchar_fd_p(fd, '-');
|
|
}
|
|
else
|
|
nb = n;
|
|
i += ft_dprintul_base(fd, nb, base);
|
|
if (i < 1)
|
|
return (-1);
|
|
return (i);
|
|
}
|