|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_print_nbrs.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2021/10/27 09:34:01 by narnaud #+# #+# */
|
|
|
|
/* Updated: 2023/04/13 12:13:19 by narnaud ### ########.fr */
|
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "ft_printf.h"
|
|
|
|
|
|
|
|
void ft_print_nbr(int n, t_opts *opts)
|
|
|
|
{
|
|
|
|
char *nbr;
|
|
|
|
char *raw;
|
|
|
|
|
|
|
|
raw = ft_itoa(n);
|
|
|
|
nbr = int_opts_transform(n, raw, opts);
|
|
|
|
opts->dot = 0;
|
|
|
|
ft_print_str(nbr, opts);
|
|
|
|
free(raw);
|
|
|
|
free(nbr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ft_print_unsign(unsigned int n, t_opts *opts)
|
|
|
|
{
|
|
|
|
char *raw;
|
|
|
|
char *nbr;
|
|
|
|
|
|
|
|
raw = ft_utoa(n);
|
|
|
|
nbr = uint_opts_transform(n, raw, opts);
|
|
|
|
opts->dot = 0;
|
|
|
|
ft_print_str(nbr, opts);
|
|
|
|
free(raw);
|
|
|
|
free(nbr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void va_print_nbr(va_list va, t_opts *opts)
|
|
|
|
{
|
|
|
|
ft_print_nbr(va_arg(va, int), opts);
|
|
|
|
}
|
|
|
|
|
|
|
|
void va_print_unsign(va_list va, t_opts *opts)
|
|
|
|
{
|
|
|
|
ft_print_unsign(va_arg(va, unsigned int), opts);
|
|
|
|
}
|