-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags_width.c
36 lines (33 loc) · 1.2 KB
/
flags_width.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flags_width.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nahmed-m <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/19 21:26:13 by nahmed-m #+# #+# */
/* Updated: 2016/01/25 16:49:20 by nahmed-m ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void flags_width(char *fmt, t_var *e)
{
char *str;
int i;
i = e->i;
if (ft_isdigit(fmt[e->i]))
{
while (ft_isdigit(fmt[e->i]))
e->i++;
str = ft_strsub(fmt, i, e->i);
e->f_width = ft_atoi(str);
free(str);
}
else
e->f_width = 0;
if (fmt[e->i] == '+')
{
e->f_positive = 1;
e->i++;
}
}