erreur resolue dans precision

This commit is contained in:
Hugo LAMY
2020-03-09 14:19:44 +01:00
parent f4df40f992
commit 12d30893f8
6 changed files with 25 additions and 3 deletions

11
exemple.txt Normal file
View File

@@ -0,0 +1,11 @@
("%.i", 0) : '' [0]
JACKPOT : '' [0]
----------------------------------------------------------------
% flags width .precision length specifier
% 0-#' + * 0..9 .* 0..9 hhhlllLjtz diuxXcsp%efgnEFGaACSo
% 0- * 0..9 .* 0..9 diuxXcsp%
% #' + hhhlll efgn
----------------------------------------------------------------

View File

@@ -108,9 +108,7 @@ char *convert_with_flags(char *s, va_list ap, char *type, int *size)
return (NULL);
if (!(print = ft_flag_transform(s, print, type, size)))
return (NULL);
// ft_putstr(s);
free(s);
s = print;
return (print);
}

1
outf.txt Normal file
View File

@@ -0,0 +1 @@
33333

1
outft.txt Normal file
View File

@@ -0,0 +1 @@
33333

View File

@@ -66,7 +66,7 @@ char *ft_precision(char *s, char *print, char *type)
{
precision = ft_atoi(tmp + 1);
*tmp = '\0';
while (ft_strchr("#- +'0", *(++s)))
while (*s && ft_strchr("#- +'0", *(++s)))
if (*s == '0')
*s = '.';
i = 0;

11
temoin.txt Normal file
View File

@@ -0,0 +1,11 @@
("%.i", 0) : '' [0]
JACKPOT : '' [0]
----------------------------------------------------------------
% flags width .precision length specifier
% 0-#' + * 0..9 .* 0..9 hhhlllLjtz diuxXcsp%efgnEFGaACSo
% 0- * 0..9 .* 0..9 diuxXcsp%
% #' + hhhlll efgn
----------------------------------------------------------------