fix forget \0 in read test

This commit is contained in:
Xamora 2026-09-20 16:50:46 +02:00
parent dbcf5e5d57
commit c6f09dc2aa

6
main.c
View file

@ -222,7 +222,8 @@ test_read() {
// printf("%s\n", in);
char buf[10];
printf("ft_read ret: %ld\n", ft_read(open("main.c", O_RDONLY), buf, 10));
printf("ft_read ret: %ld\n", ft_read(open("main.c", O_RDONLY), buf, 9));
buf[9] = '\0';
printf ("buf: %s\n", buf);
size_t error = ft_read(open("test", O_RDWR), buf, 10);
printf("ft_read error: %ld\n", error);
@ -242,7 +243,8 @@ test_read() {
// printf("%s\n", in);
char buf[10];
printf("read ret: %ld\n", read(open("main.c", O_RDONLY), buf, 10));
printf("read ret: %ld\n", read(open("main.c", O_RDONLY), buf, 9));
buf[9] = '\0';
printf ("buf: %s\n", buf);
size_t error = read(open("test", O_RDWR), buf, 10);
printf("read error: %ld\n", error);