mirror of
https://github.com/LucasCodeur/alcu.git
synced 2026-04-28 17:44:34 +02:00
FEAT: add vector, fix standard input
This commit is contained in:
+11
-10
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user