-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
37 lines (33 loc) · 631 Bytes
/
main.c
File metadata and controls
37 lines (33 loc) · 631 Bytes
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
#include "get_next_line.h"
#include <fcntl.h>
int main(void)
{
// int fd1 = open("multiple_nlx5", O_RDONLY);
// int fd1 = open("./txt1.txt", O_RDONLY);
// int fd1 = open("txt2.txt", O_RDONLY);
// int fd1 = open("txt3.txt", O_RDONLY);
int fd1 = stdin;
char *str = NULL;
while (1 == 1)
{
str = get_next_line(fd1);
printf(" >>> %s", str);
fflush(stdout);
if (str != NULL)
{
free(str);
str = NULL;
}
else
break;
}
// printf(">>>%s\n\n\n", str);
// free(str);
// str = get_next_line(fd1);
// printf(">>>%s\n\n\n", str);
// free(str);
// close(fd1);
// close(fd2);
// close(fd3);
return 0;
}