aboutsummaryrefslogtreecommitdiff
path: root/ft_printf.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-31 01:45:37 +0100
committerCharles <sircharlesaze@gmail.com>2019-10-31 01:45:37 +0100
commit0f6cd15b0c7ce2d4d0154ae027985ed640cd543f (patch)
treeb30dc09db7e42b1e1e9924995b608ee153daddc5 /ft_printf.c
parentd63d6916249f5b40b81097854d8ca2c9d4d7d071 (diff)
downloadft_printf-0f6cd15b0c7ce2d4d0154ae027985ed640cd543f.tar.gz
ft_printf-0f6cd15b0c7ce2d4d0154ae027985ed640cd543f.tar.bz2
ft_printf-0f6cd15b0c7ce2d4d0154ae027985ed640cd543f.zip
Handle 'n' flag
Diffstat (limited to 'ft_printf.c')
-rw-r--r--ft_printf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ft_printf.c b/ft_printf.c
index 0352b52..d71f397 100644
--- a/ft_printf.c
+++ b/ft_printf.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/29 00:15:28 by cacharle #+# #+# */
-/* Updated: 2019/10/30 19:58:36 by cacharle ### ########.fr */
+/* Updated: 2019/10/31 00:10:04 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -38,14 +38,23 @@ int ft_printf(const char *format, ...)
if (format[i] != '%')
{
write(STDOUT_FILENO, format + i, 1);
+ print_len++;
continue ;
}
str = convert(flist->content, ap);
+ if (str == NULL && flist->content->type == 'n')
+ {
+ *flist->content->written = print_len;
+ i += flist->content->fmt_len;
+ list_pop_front(&flist);
+ continue;
+ }
if (str == NULL)
{
list_destroy(&flist);
return (-1);
}
+ printf("\n%c\n", flist->content->type);
if (flist->content->type == 'c')
{
write(1, str, flist->content->size);