-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.c
41 lines (37 loc) · 1.31 KB
/
ft_printf.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vde-vasc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/13 04:07:13 by vde-vasc #+# #+# */
/* Updated: 2022/07/14 18:39:26 by vde-vasc ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *text, ...)
{
va_list arguments;
int symbol;
int result;
symbol = 0;
result = 0;
va_start(arguments, text);
while (text[symbol])
{
if (text[symbol] == '%' && ft_strchr("cspdiuxX%", text[symbol + 1]))
{
result += argument_case(text[symbol + 1], arguments);
symbol++;
}
else
{
ft_putchar(text[symbol]);
result++;
}
symbol++;
}
va_end(arguments);
return (result);
}