From 687059d5a0a367406aa2c15e155af2415867b4cd Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 4 Mar 2020 17:35:28 +0100 Subject: Correct --- src/ft_save_to_bmp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/ft_save_to_bmp.c') diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index 79c34af..66f8b86 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -26,19 +26,19 @@ static char if (!(str = (char*)malloc((ft_strlen(FT_BMP_SAVE_DIR) + ft_strlen(ft_strrchr(ml->filename, '/') + 1) + 1) * sizeof(char)))) return (NULL); ft_printf("%lu\n", (ft_strlen(FT_BMP_SAVE_DIR) + ft_strlen((ft_strrchr(ml->filename, '/') + 1)) + 1)); - ft_sprintf(str, "%s%s.bmp", FT_BMP_SAVE_DIR, + ft_sprintf(str, "%s%s", FT_BMP_SAVE_DIR, ft_strrchr(ml->filename, '/') + 1); - return (str); } else { - /* if (!(str = (char*)malloc((ft_strlen(FT_BMP_SAVE_DIR) + */ - /* ft_strlen(ml->filename) + 1)* sizeof(char)))) */ - /* return (NULL); */ - /* ft_sprintf(str, "%s%s.bmp", FT_BMP_SAVE_DIR, ml->filename); */ + if (!(str = (char*)malloc((ft_strlen(FT_BMP_SAVE_DIR) + + ft_strlen(ml->filename) + 1)* sizeof(char)))) + return (NULL); + ft_sprintf(str, "%s%s.bmp", FT_BMP_SAVE_DIR, ml->filename); } - /* return (str); */ - return (NULL); + ft_memcpy(ft_strrchr(str, '.') + 1, "bmp", 3); + return (str); + /* return (NULL); */ } /* static int8_t */ -- cgit v1.2.3