Start bonus with flags

This commit is contained in:
gbaconni
2022-04-25 13:19:42 +02:00
parent be4099ab31
commit 42f6f1fd1a
4 changed files with 53 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_vprintf_flags_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/25 13:15:32 by gbaconni #+# #+# */
/* Updated: 2022/04/25 13:17:47 by gbaconni ### lausanne.ch */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
int ft_vprintf_flags_bonus(const char *format, va_list ap)
{
int ret;
ret = 0;
(void) ap;
while (*format != '\0')
{
if (*format == '#')
ret |= F_HASH;
else if (*format == '0')
ret |= F_ZERO;
else if (*format == '-')
ret |= F_MINUS;
else if (*format == ' ')
ret |= F_SPACE;
else if (*format == '+')
ret |= F_PLUS;
format++;
}
return (ret);
}