/
main.c
40 lines (37 loc) · 1.34 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ajubert <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/22 13:49:51 by ajubert #+# #+# */
/* Updated: 2016/01/22 16:31:26 by ajubert ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char **argv)
{
int test;
char **line;
int fd;
(void)argc;
line = (char **)malloc(sizeof(char *) * 1);
line[0] = ft_strdup("\0");
fd = open(argv[1], O_RDONLY);
ft_putnbr(fd);
ft_putchar('\n');
test = 1;
while (test == 1)
{
test = get_next_line(fd, line);
ft_putnbr(test);
ft_putendl(line[0]);
}
free(line);
return (0);
}