32 lines
525 B
C
32 lines
525 B
C
|
|
#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);
|
||
|
|
}
|