0
0
Files
42piscine/Rush_02/rush-02/ex00/dictionnaries/dictionnaries.c

32 lines
525 B
C
Raw Normal View History

2021-08-21 19:03:19 +02:00
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include "../ft/ft.h"
#define BUF_SIZE 4096
// cc -Wall -Wextra -Werror -o a.out -L../ft -lft dictionnaries.c && ./a.out && rm a.out
int main()
{
int fd;
int ret;
char buf[BUF_SIZE + 1];
fd = open ("numbers.dict", O_RDONLY);
if (fd == -1)
{
ft_putstr("open () error");
return (1);
}
ret = read(fd, buf, BUF_SIZE);
buf[ret] = '\0';
ft_putnbr(ret);
ft_putstr(buf);
if (close(fd) == -1)
{
ft_putstr("Close() error");
return(1);
}
return (0);
}