Projet de l'école 42 : Printf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB

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