-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
54 lines (49 loc) · 1.46 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
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gialexan <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/07 13:11:29 by gialexan #+# #+# */
/* Updated: 2023/09/06 08:05:34 by gialexan ### ########.fr */
/* */
/* ************************************************************************** */
#include <fcntl.h>
#include <stdio.h>
#include "get_next_line.h"
int main(void)
{
char *temp;
int fd;
fd = open("myfile.txt", O_RDONLY);
while (1)
{
temp = get_next_line(fd);
if (!temp)
break ;
printf("%s", temp);
free(temp);
}
return (0);
}
/*
// Test function read
// Test file descriptor
// Test all value in BUFFER_SIZE -> flag = -D BUFFER_SIZE=2
int main(int argc, char **argv)
{
int fd;
ssize_t bytes;
char buffer[256];
fd = 0;
bytes = 1;
while (bytes != 0)
{
bytes = read(fd, buffer, BUFFER_SIZE);
buffer[bytes] = '\0';
printf("%s", buffer);
}
return (0);
}
*/