-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_mlt.c
44 lines (40 loc) · 1.42 KB
/
main_mlt.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
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main_mlt.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ashongwe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/26 13:28:48 by ashongwe #+# #+# */
/* Updated: 2019/06/26 14:55:12 by ashongwe ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
#include "libft/libft.h"
#include <stdio.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <sys/types.h>
int main(int argc, char const *argv[]) {
int fd;
int fd_2;
int i;
char *line;
int status;
fd = open(argv[1], O_RDONLY);
i = 1;
while ((status = get_next_line(fd, &line)) == 1 && i < 500)
{
printf("[%d] %s\n", i++, line);
free(line);
}
fd_2 = open(argv[2], O_RDONLY);
close(fd);
fd = fd_2;
while ((status = get_next_line(fd, &line)) == 1)
{
printf("[%d] %s\n", i++, line);
free(line);
}
return (argc);
}