Project develop for 42Cursus
This project will not only allow you to add a very convenient function to your collection, but it will also allow you to learn a highly interesting new concept in C programming: static variables
May it be a file, stdin, or even later a network connection, you will always need a way to read content line by line. It is time to start working on this function, which will be essential for your future projects.
Unix logic
Unix
Rigor
Algorithms & AI
Write a function which returns a line read from a file descriptor
char *get_next_line(int fd);
File descriptor to read from
Value Read line: correct behavior NULL: nothing else to read or an error occurred;
read(2)
malloc(3)
free(1)
To be able to manage multiple file descriptors with your get_next_line. For example, if the file descriptors 3, 4 and 5 are accessible for reading, then you can call get_next_line once on 3, once on 4, once again on 3 then once on 5 etc. without losing the reading thread on each of the descriptors.