Start bonus with flags
This commit is contained in:
36
libftprintf/ft_vprintf_flags_bonus.c
Normal file
36
libftprintf/ft_vprintf_flags_bonus.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user