wip_parsing
This commit is contained in:
46
src/parsing/check_arg.c
Normal file
46
src/parsing/check_arg.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* check_arg.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/04 21:33:35 by madumerg #+# #+# */
|
||||
/* Updated: 2024/09/07 17:57:29 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../include/cub3d.h"
|
||||
|
||||
int check_err_arg(int ac, char **av)
|
||||
{
|
||||
int fd;
|
||||
int rd;
|
||||
char buf[10];
|
||||
|
||||
if (ac != 2)
|
||||
return (err_mess(ERR_ARGS));
|
||||
if (check_format_file(av[1]) == 0)
|
||||
return (err_mess(ERR_TYPE));
|
||||
fd = open(av[1], O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
close(fd);
|
||||
return (err_mess(EMPTY));
|
||||
}
|
||||
rd = read(fd, buf, 10);
|
||||
close(fd);
|
||||
return (rd);
|
||||
}
|
||||
|
||||
int check_format_file(char *file)
|
||||
{
|
||||
int len;
|
||||
|
||||
len = ft_strlen(file) - 1;
|
||||
if (file[len] == 'b' && file[len - 1] == 'u' && \
|
||||
file[len - 2] == 'c' && file[len - 3] == '.')
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
0
src/parsing/check_id_text.c
Normal file
0
src/parsing/check_id_text.c
Normal file
0
src/parsing/check_map.c
Normal file
0
src/parsing/check_map.c
Normal file
0
src/parsing/check_rgb.c
Normal file
0
src/parsing/check_rgb.c
Normal file
18
src/parsing/memo_parsing
Normal file
18
src/parsing/memo_parsing
Normal file
@ -0,0 +1,18 @@
|
||||
char **map = ft_parse_map(av[1]);
|
||||
int i = 0;
|
||||
while (map[i])
|
||||
{
|
||||
ft_putchar_fd('*', 2);
|
||||
ft_putstr_fd(map[i], 2);
|
||||
ft_putchar_fd('*', 2);
|
||||
ft_putchar_fd('\n', 2);
|
||||
i++;
|
||||
}
|
||||
//envoyer de 0 a 3 inclus dans check id texture
|
||||
//envoyer de 4 a 5 inclus dans check rgb format
|
||||
//envoyer de 6 a jusqu a la fin dans check map
|
||||
|
||||
struct typedef s_pars
|
||||
{
|
||||
|
||||
} t_pars;
|
Reference in New Issue
Block a user