👋Hey y'all this project it's all about how to read lines in a fd
.
The fuction that we allow to use is read
malloc
free
, now if we use read it gonna read the whole file content but we want to read line by line so we have to make three fuctions one for reading the fd
the second one counts the first line and allocate it and return it and the rest we allocate it in the third function, don't forget we use BUFFER_SIZE
to specifie how much read
function gonna read.
The project PDF:
https://cdn.intra.42.fr/pdf/pdf/37926/en.subject.pdf
Tester:
https://github.com/Tripouille/gnlTester.git
Prototype:
char *get_next_line(int fd);
How to compile:
gcc -W -W -W -D BUFFER_SIZE=n files
- Medium: Check it out.
- Static char Check it out.
I done the mandatory part and the bonus part, the bonus it's about reading content in every opened fd btw The max opened fd in a pc is 1024
and take a look in *str[fd] array of a pointer
.
That's all thank u for reading, have a good one 🚀