copy on git
This commit is contained in:
commit
42653de246
205 changed files with 7459 additions and 0 deletions
58
libft/ft_printf/ft_cases_mandatory_two.c
Executable file
58
libft/ft_printf/ft_cases_mandatory_two.c
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_cases_mandatory_two.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/22 18:52:33 by thrieg #+# #+# */
|
||||
/* Updated: 2025/02/16 19:07:58 by thrieg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
#include "ft_printf.h"
|
||||
|
||||
int ft_case_x(t_vector *vec, va_list *args)
|
||||
{
|
||||
char *str_to_cat;
|
||||
|
||||
str_to_cat = ft_utoa_base(va_arg(*args, unsigned int), "0123456789abcdef");
|
||||
if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat)))
|
||||
return (free(str_to_cat), 0);
|
||||
free(str_to_cat);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ft_case_upperx(t_vector *vec, va_list *args)
|
||||
{
|
||||
char *str_to_cat;
|
||||
|
||||
str_to_cat = ft_utoa_base(va_arg(*args, unsigned int), "0123456789ABCDEF");
|
||||
if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat)))
|
||||
return (free(str_to_cat), 0);
|
||||
free(str_to_cat);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ft_case_d(t_vector *vec, va_list *args)
|
||||
{
|
||||
char *str_to_cat;
|
||||
|
||||
str_to_cat = ft_itoa(va_arg(*args, int));
|
||||
if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat)))
|
||||
return (free(str_to_cat), 0);
|
||||
free(str_to_cat);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int ft_case_i(t_vector *vec, va_list *args)
|
||||
{
|
||||
char *str_to_cat;
|
||||
|
||||
str_to_cat = ft_itoa(va_arg(*args, int));
|
||||
if (!ft_vector_concat(vec, str_to_cat, ft_strlen(str_to_cat)))
|
||||
return (free(str_to_cat), 0);
|
||||
free(str_to_cat);
|
||||
return (1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue