fix: outfile is now perfectly removed

This commit is contained in:
Camille Chauvet 2023-02-17 18:51:27 +01:00
parent 922db1e08f
commit 4b5a50d7fe
4 changed files with 9 additions and 6 deletions

BIN
.outfile.c.swp Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 17:52:10 by cchauvet #+# #+# */ /* Created: 2023/02/15 17:52:10 by cchauvet #+# #+# */
/* Updated: 2023/02/17 13:19:09 by cchauvet ### ########.fr */ /* Updated: 2023/02/17 18:30:30 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -92,7 +92,7 @@ static int ft_remove_infile(char *line)
ft_strshift(line + y, -1 * (ft_strlen(tab[i]) + 1)); ft_strshift(line + y, -1 * (ft_strlen(tab[i]) + 1));
} }
else else
y = y + ft_strlen(tab[i]); y = y + ft_strlen(tab[i]) + 1;
i++; i++;
} }
ft_freer_tab_ultimate(1, tab); ft_freer_tab_ultimate(1, tab);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 18:01:07 by cchauvet #+# #+# */ /* Created: 2023/02/15 18:01:07 by cchauvet #+# #+# */
/* Updated: 2023/02/17 13:19:46 by cchauvet ### ########.fr */ /* Updated: 2023/02/17 18:50:02 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -86,12 +86,14 @@ static int ft_remove_outfile(char *line)
{ {
if (tab[i][0] == '>') if (tab[i][0] == '>')
{ {
ft_strshift(line + y, -1 * (ft_strlen(tab[i]) + 1)); ft_strshift(line + y, -1 * (ft_strlen(tab[i]) + ft_strlen(tab[i + 1]) + 2));
i++;
ft_strshift(line + y, -1 * (ft_strlen(tab[i]) + 1));
} }
else else
{
if (y != 0)
y++;
y = y + ft_strlen(tab[i]); y = y + ft_strlen(tab[i]);
}
i++; i++;
} }
ft_freer_tab_ultimate(1, tab); ft_freer_tab_ultimate(1, tab);

1
t Normal file
View File

@ -0,0 +1 @@
bozo