-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandle_format.c
More file actions
39 lines (35 loc) · 1.86 KB
/
handle_format.c
File metadata and controls
39 lines (35 loc) · 1.86 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_format.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sprodatu <sprodatu@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/14 07:14:46 by sprodatu #+# #+# */
/* Updated: 2024/05/03 21:52:01 by sprodatu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft/libft.h"
#include "ft_printf.h"
int handle_format(t_format format_info, va_list args)
{
int char_count;
char_count = 0;
if (format_info.specifier == 'c')
char_count = handle_char(format_info, args);
if (format_info.specifier == 's')
char_count += handle_str(format_info, args);
if (format_info.specifier == '%')
char_count += handle_percent(format_info);
if (format_info.specifier == 'd' || format_info.specifier == 'i')
char_count += handle_int(&format_info, va_arg(args, int));
if (format_info.specifier == 'u')
char_count += handle_uint(&format_info, va_arg(args, unsigned int));
if (format_info.specifier == 'x' || format_info.specifier == 'X')
char_count += handle_hexa(format_info, va_arg(args, unsigned int));
if (format_info.specifier == 'p')
char_count += handle_pointer(format_info, va_arg(args, void *));
return (char_count);
}
// if (format_info.specifier == 'd' || format_info.specifier == 'i')
// char_count += handle_int(&format_info, va_arg(args, int));