diff --git a/main.c b/main.c index 43db9d1..9f48a2b 100644 --- a/main.c +++ b/main.c @@ -816,15 +816,21 @@ int main(int ac, char **av) printf("----------------------------------------------------------------\n\n"); char *s; - PRINT("%p", "test") - PRINT("%p", s) + PRINT("%p", "test"); + PRINT("%p", s); s = "truc"; - PRINT("%p", s) + PRINT("%p", s); unsigned int u = 4; - PRINT("%p", &u) - PRINT("%s-%p", s, s) - PRINT("%u-%p", u, &u) - PRINT("%up", u) + PRINT("%p", &u); + PRINT("%s-%p", s, s); + PRINT("%u-%p", u, &u); + PRINT("%up", u); + PRINT("%p", NULL); + PRINT("%5p", NULL); + PRINT("%05p", NULL); + PRINT("%0p", NULL); + PRINT("%5.p", NULL); + PRINT("%5.5p", NULL); } if (ac == 2 || !strcmp(av[2], "%")) diff --git a/outf.txt b/outf.txt new file mode 100644 index 0000000..35eafff --- /dev/null +++ b/outf.txt @@ -0,0 +1 @@ +(nil) diff --git a/outft.txt b/outft.txt new file mode 100644 index 0000000..e60321b --- /dev/null +++ b/outft.txt @@ -0,0 +1 @@ + 0x0 diff --git a/srcs/ft_flag_transform.c b/srcs/ft_flag_transform.c index 79ac07a..04a56be 100644 --- a/srcs/ft_flag_transform.c +++ b/srcs/ft_flag_transform.c @@ -188,13 +188,13 @@ char *ft_flag_transform(char *s, char *print, char *type, int *size) print = ft_precision(s, print, type); print = ft_plus(s, print, type); print = ft_sharp(s, print, type); - print = ft_width(s, print, size, type); - print = ft_sharp_again(s, print, type); - print = ft_space(s, print, type, size); if (ft_strchr(type, 'p')) { print = ft_concat_free(ft_strdup("0x"), print); *size += 2; } + print = ft_width(s, print, size, type); + print = ft_sharp_again(s, print, type); + print = ft_space(s, print, type, size); return (print); }