FEAT: add vector, fix standard input

This commit is contained in:
LucasCodeur
2026-03-29 15:42:32 +02:00
parent 4150e95378
commit 3e599160d8
57 changed files with 961 additions and 56 deletions
+11 -10
View File
@@ -12,30 +12,31 @@
#include "../libft/libft.h"
#include "get_next_line.h"
#include "vector.h"
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
int check_input(int fd)
bool check_input(t_vector* lines)
{
int i;
int j;
char *line;
char* line;
line = NULL;
line = get_next_line(fd);
j = 0;
while (line != NULL)
line = NULL;
while (j < lines->pfVectorTotal(lines))
{
line = (char*)lines->pfVectorGet(lines, j);
i = -1;
while (line[++i])
if (!(line[i] >= '0' && line[i] <= '9') && line[i] != '\n')
return (free(line), -1);
return (false);
if (ft_atoi(line) < 1 || ft_atoi(line) > 10000)
return (free(line), -1);
free(line);
return (false);
j++;
line = get_next_line(fd);
}
return (j);
return (true);
}