-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_printf.c
More file actions
50 lines (46 loc) · 1.39 KB
/
ft_printf.c
File metadata and controls
50 lines (46 loc) · 1.39 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
39
40
41
42
43
44
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: slargo-b <slargo-b@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/03 11:51:49 by slargo-b #+# #+# */
/* Updated: 2025/02/07 15:33:51 by slargo-b ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_printf(const char *str, ...)
{
va_list args;
int i;
int len;
if (!str)
return (-1);
va_start(args, str);
i = 0;
len = 0;
while (str[i])
{
if (str[i] == '%')
{
len = len + ft_format(args, str[i + 1]);
i++;
}
else
len = len + ft_putchar(str[i]);
i++;
}
va_end(args);
return (len);
}
/*
#include <stdio.h>
int main()
{
//printf(" NULL %s NULL ", NULL);
// ft_printf("a ve que imprime: %s\n", "hello world");
//return 0;
//esto es para hacer mi comit en git :3
}
*/