-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
49 lines (46 loc) · 1.52 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
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: youkim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/12 16:34:49 by youkim #+# #+# */
/* Updated: 2021/06/15 13:45:40 by youkim ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "get_next_line.h"
int main(void)
{
int m;
int f;
int fd;
int stat;
char *line;
char *fc;
// stat = get_next_line(0, &line);
// printf("%d#%s#", stat, line);
//*
printf("fd max / max iterations:");
scanf("%d%d", &f, &m);
for (; f > 2; f--)
{
fc = malloc(2);
*fc = (char)(f + '0');
*(fc + 1) = 0;
printf("RESULT for fd #%d\n", f);
printf("opening %s\n", ft_strjoin(fc, ".txt"));
fd = open(fc, O_RDONLY);
for (int i = 0; i < m; i++)
{
stat = get_next_line(fd, &line);
printf(">>>%d/%d\n#%s#\n", i, stat, line);
}
printf("DONE\n\n");
}
//*/
return (0);
}