-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
34 lines (31 loc) · 1.17 KB
/
ft_printf.c
File metadata and controls
34 lines (31 loc) · 1.17 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ecarvalh <ecarvalh@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/05 10:32:29 by ecarvalh #+# #+# */
/* Updated: 2024/01/05 10:32:37 by ecarvalh ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *format, ...)
{
va_list args;
int len;
int i;
i = 0;
len = 0;
va_start(args, format);
while (format[i])
{
if (format[i] == '%')
len += ft_eval(args, format, &i);
else
len += write(1, &format[i], 1);
i++;
}
va_end(args);
return (len);
}