-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
41 lines (37 loc) · 1.3 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
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nidionis <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/04 16:20:59 by nidionis #+# #+# */
/* Updated: 2024/11/16 15:02:38 by nidionis ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
#include <stdio.h>
#include "get_next_line.h"
void get_next_line_tester(int argc, char **argv)
{
int fd;
char *line;
if (argc == 2)
{
fd = open(argv[1], O_RDONLY);
while ((line = get_next_line(fd)))
{
printf("%s", line);
free(line);
line = NULL;
}
close(fd);
}
else
printf("Usage: %s <file>\n", argv[0]);
}
int main(int argc, char **argv)
{
get_next_line_tester(argc, argv);
return (0);
}