#include #include #include int ft_get_sprite_tex(int fd, t_win *wlist) { char *line; char **words; size_t len; get_next_line(fd, &line); if (!(words = ft_split(line, ' '))) { ft_memdel(line); return (ft_exit(5, wlist)); } if (!(*words) || ft_strcmp(*words, "S") || !words[1] || words[2]) { ft_free_words(words, line); return (ft_map_error(7, wlist)); } ft_memdel(wlist->clist->sprite_path); len = ft_strlen(*(words + 1)); if (!(wlist->clist->sprite_path = (char*)malloc((len + 1) * sizeof(char)))) { ft_free_words(words, line); return (-1); } ft_strlcpy(wlist->clist->sprite_path, *(words + 1), len + 1); ft_free_words(words, line); return (0); }