diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-04 17:35:28 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-04 17:35:28 +0100 |
commit | 687059d5a0a367406aa2c15e155af2415867b4cd (patch) | |
tree | 7047d51c2306069acd5508bb84f7c11cd6c67125 /src/ft_save_to_bmp.c | |
parent | File names (diff) | |
download | 42-cub3d-687059d5a0a367406aa2c15e155af2415867b4cd.tar.gz 42-cub3d-687059d5a0a367406aa2c15e155af2415867b4cd.tar.bz2 42-cub3d-687059d5a0a367406aa2c15e155af2415867b4cd.tar.xz 42-cub3d-687059d5a0a367406aa2c15e155af2415867b4cd.tar.zst 42-cub3d-687059d5a0a367406aa2c15e155af2415867b4cd.zip |
Correct
Diffstat (limited to 'src/ft_save_to_bmp.c')
-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 */ |