This commit is contained in:
Etienne Rey-bethbeder 2022-11-25 11:21:19 +01:00
parent cca279bf26
commit 9a4a5aa28c

View file

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/12 16:27:59 by erey-bet #+# #+# */ /* Created: 2022/10/12 16:27:59 by erey-bet #+# #+# */
/* Updated: 2022/11/21 19:14:36 by erey-bet ### ########.fr */ /* Updated: 2022/11/22 22:53:10 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -67,10 +67,12 @@ int ft_printf(const char *str, ...)
int i; int i;
int count; int count;
if (str == NULL)
return (-1);
va_start(args, str); va_start(args, str);
i = 0; i = -1;
count = 0; count = 0;
while (str[i]) while (str[++i])
{ {
if (str[i] == '%' && ft_is_format(str[i + 1])) if (str[i] == '%' && ft_is_format(str[i + 1]))
{ {
@ -82,7 +84,6 @@ int ft_printf(const char *str, ...)
ft_putchar(str[i]); ft_putchar(str[i]);
count++; count++;
} }
i++;
} }
va_end(args); va_end(args);
return (count); return (count);