Adding v0 parse_input

This commit is contained in:
Manzovince
2019-04-14 18:03:55 +02:00
parent 451a07b762
commit 1d244568dc
3 changed files with 33 additions and 9 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
objs/

View File

@@ -6,7 +6,7 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 17:46:32 by vmanzoni ### ########.fr */
/* Updated: 2019/04/14 17:53:24 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
@@ -41,16 +41,11 @@ int check_file_errors(char *file)
return (1);
if (file[i] == '\n')
line_nbr++;
if (file[i] == '\n' && file[i+1] == '\n')
return (1);
i++;
}
if (line_nbr < 4 || line_nbr > 129)
return (1);
return (0);
}
/*
int ft_tetri_errors()
{
}
*/

View File

@@ -6,12 +6,16 @@
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 17:44:18 by vmanzoni ### ########.fr */
/* Updated: 2019/04/14 18:03:20 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
/*
** Function that read and return a ptr to file
*/
char *read_file(char *file)
{
char buf[BUFF_SIZE];
@@ -35,3 +39,26 @@ char *read_file(char *file)
close(fd);
return (result);
}
/*
** Function that parse a file and return each tetrimino
*/
int parse_input(char *input)
{
int i;
int j;
int nl;
i = 0;
nl = 0;
while (input[i])
{
j = 0;
while (j != 4)
{
square[j][] =
j++;
}
}
}