diff options
-rw-r--r-- | src/ft_save_to_bmp.c | 16 |
1 files changed, 8 insertions, 8 deletions
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 */ |