-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
37 lines (34 loc) · 1.29 KB
/
main.c
File metadata and controls
37 lines (34 loc) · 1.29 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ewilliam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/26 10:31:56 by ewilliam #+# #+# */
/* Updated: 2016/12/28 14:45:35 by ewilliam ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
#include <fcntl.h>
int main(int argc, char **argv)
{
int status;
char *line;
int fd;
line = NULL;
fd = (argc == 2)
? open(argv[1], O_RDONLY)
: 0;
// argc = 0;
// argv = 0;
// fd = open("/nfs/2016/e/ewilliam/Documents/gnl/test3.txt", O_RDONLY);
while ((status = get_next_line(fd, &line)) == 1)
{
ft_putendl(line);
free(line);
}
ft_putnbr(status);
ft_putendl(line);
return (0);
}