-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf.c
40 lines (37 loc) · 1.27 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: chonorat <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/07 16:13:24 by chonorat #+# #+# */
/* Updated: 2022/12/29 16:50:32 by chonorat ### ########.fr */
/* */
/* ************************************************************************** */
#include "Includes/ft_printf.h"
int ft_printf(const char *str, ...)
{
int index;
int strlenght;
va_list param;
va_start(param, str);
strlenght = 0;
index = 0;
while (str[index])
{
if (str[index] == '%')
{
index++;
strlenght += ft_get_type(str[index], param);
}
else
{
ft_putchar_fd(str[index], 1);
strlenght += 1;
}
index++;
}
va_end(param);
return (strlenght);
}