-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
38 lines (35 loc) · 1.25 KB
/
ft_printf.c
File metadata and controls
38 lines (35 loc) · 1.25 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
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dporhomo <dporhomo@student.42prague.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/02 13:40:51 by dporhomo #+# #+# */
/* Updated: 2025/12/09 10:24:04 by dporhomo ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *format, ...)
{
va_list args;
t_print tab;
if (!format)
return (-1);
tab.i = 0;
tab.count = 0;
va_start(args, format);
while (format[tab.i])
{
if (format[tab.i] == '%')
ft_parse_format(format, args, &tab);
else
{
write(1, &format[tab.i], 1);
tab.count++;
}
tab.i++;
}
va_end(args);
return (tab.count);
}