diff --git a/a.out b/a.out index 9f61a65..56ff783 100755 Binary files a/a.out and b/a.out differ diff --git a/fdf.h b/fdf.h index cb4bbbf..d99de1f 100644 --- a/fdf.h +++ b/fdf.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/11 05:10:42 by adjoly #+# #+# */ -/* Updated: 2023/12/20 10:21:53 by adjoly ### ########.fr */ +/* Updated: 2023/12/23 08:20:35 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,8 +35,9 @@ typedef struct s_map char *color; } t_map; -int ft_read_map(int fd, char **map); -size_t ft_countline_fd(int fd); -char **ft_getmap(char *file); +// int ft_read_map(int fd, char **map); +// size_t ft_countline_fd(int fd); +// char **ft_getmap(char *file); +// char *get_next_line(int fd); #endif \ No newline at end of file diff --git a/fdf.h.gch b/fdf.h.gch new file mode 100644 index 0000000..031b424 Binary files /dev/null and b/fdf.h.gch differ diff --git a/get_next_line/get_next_line.c b/get_next_line/get_next_line.c index 1cd515d..41260b6 100644 --- a/get_next_line/get_next_line.c +++ b/get_next_line/get_next_line.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/01 17:11:59 by adjoly #+# #+# */ -/* Updated: 2023/12/18 09:18:43 by adjoly ### ########.fr */ +/* Updated: 2023/12/23 06:51:37 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -61,7 +61,7 @@ char *get_next_line(int fd) res = ft_calloc(1, 1); while (buf) { - res = ft_strjoin(res, buf); + res = ft_strjoinf(res, buf); if (!res) return (NULL); if (check_line(res, buf)) diff --git a/get_next_line/get_next_line.h b/get_next_line/get_next_line.h index a1f0d5f..49ac8c0 100644 --- a/get_next_line/get_next_line.h +++ b/get_next_line/get_next_line.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/01 17:12:00 by adjoly #+# #+# */ -/* Updated: 2023/12/18 09:27:15 by adjoly ### ########.fr */ +/* Updated: 2023/12/23 06:51:07 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,7 @@ # endif char *get_next_line(int fd); -char *ft_strjoin(const char *s1, const char *s2); +char *ft_strjoinf(char *s1, char *s2); // size_t ft_strlen(char *s); // void *ft_calloc(size_t nmemb, size_t size); diff --git a/get_next_line/get_next_line.h.gch b/get_next_line/get_next_line.h.gch index aa519f8..a88c38f 100644 Binary files a/get_next_line/get_next_line.h.gch and b/get_next_line/get_next_line.h.gch differ diff --git a/get_next_line/get_next_line_bonus.h.gch b/get_next_line/get_next_line_bonus.h.gch new file mode 100644 index 0000000..403efb1 Binary files /dev/null and b/get_next_line/get_next_line_bonus.h.gch differ diff --git a/get_next_line/get_next_line_utils.c b/get_next_line/get_next_line_utils.c index 4441c87..9fbd073 100644 --- a/get_next_line/get_next_line_utils.c +++ b/get_next_line/get_next_line_utils.c @@ -6,23 +6,24 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/01 17:12:02 by adjoly #+# #+# */ -/* Updated: 2023/12/15 05:38:33 by adjoly ### ########.fr */ +/* Updated: 2023/12/23 06:52:24 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "get_next_line.h" +#include "../libft/libft.h" -size_t ft_strlen(char *s) -{ - size_t i; +// size_t ft_strlen(char *s) +// { + // size_t i; +// + // i = 0; + // while (s[i]) + // i++; + // return (i); +// } - i = 0; - while (s[i]) - i++; - return (i); -} - -char *ft_strjoin(char *s1, char *s2) +char *ft_strjoinf(char *s1, char *s2) { char *result; size_t i; diff --git a/libft/libft.h.gch b/libft/libft.h.gch index eef1b03..7142c9e 100644 Binary files a/libft/libft.h.gch and b/libft/libft.h.gch differ diff --git a/maps_reader.c b/maps_reader.c index b8e7868..7e4107e 100644 --- a/maps_reader.c +++ b/maps_reader.c @@ -6,15 +6,14 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/12 05:19:39 by adjoly #+# #+# */ -/* Updated: 2023/12/20 10:43:54 by adjoly ### ########.fr */ +/* Updated: 2023/12/23 08:29:30 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "fdf.h" #include "libft/libft.h" -#include -#include #include + void ft_putstr(char *s){int i = 0;while(s[i]){write(1, &s[i], 1);i++;}} size_t ft_countline_fd(int fd) @@ -63,19 +62,22 @@ int ft_read_map(int fd, char **map) if (i == 0 && map[i] == NULL) return (-1); close(fd); + map[i + 1] = NULL; return (i); } -char **ft_getmap(char *file) +char **ft_getmap(const char *file) { char **map; int fd; int line_nb; + printf("mais รงรก fait quelque chose au moins\n"); fd = open(file, O_RDONLY); + printf("file opened"); line_nb = ft_countline_fd(fd); - map = ft_calloc(sizeof(char), line_nb); close(fd); + map = ft_calloc(sizeof(char), line_nb); printf("linenb %d", line_nb); fd = open(file, O_RDONLY); ft_read_map(fd, map); @@ -129,14 +131,19 @@ t_map **ft_parse_map(char **mapfile) int main(int ac, char **av) { - (void)ac; char **map; int i = 0; + printf("%s", av[1]); map = ft_getmap(av[1]); + (void)ac; ft_putstr("map read"); while (map[i]) { ft_putstr(map[i]); + free(map[i]); i++; } + free(map); } + +//cc maps_reader.c fdf.h get_next_line/get_next_line.c get_next_line/get_next_line.h get_next_line/get_next_line_utils.c libft/libft.a \ No newline at end of file