Bad mess, please ignore
This commit is contained in:
commit
60514beb45
5 changed files with 215 additions and 0 deletions
42
test.c
Normal file
42
test.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* test.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/24 11:51:57 by kcolin #+# #+# */
|
||||
/* Updated: 2024/10/24 11:59:09 by kcolin ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "get_next_line.h"
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
char *line;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
line = "";
|
||||
while (line != NULL)
|
||||
{
|
||||
line = get_next_line(fd);
|
||||
if (line != NULL)
|
||||
{
|
||||
printf("%s", line);
|
||||
free(line);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Usage: %s <path>\n", argv[0]);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue