/Get_Next_Line

This proyect is about a function that returns a line read from a file descriptor (fd).

Primary LanguageC

GNLBonus GNLBonus

~GET_NEXT_LINE~
success 125/100

This proyect is about a function that returns a line read from a file descriptor (fd). Everytime we give a call, the function return a new line, until we reach the end of the text. Every string is null terminated.
As soon that we don't have more text inside the fd, our function will return ('NULL') , and the program ends.


Allowed functions : malloc, open, read, free.


If you dont know how to use open() and read() functions, there is an easy guide for you.

What is a File Descriptor?

A file descriptor is an int variable that uniquely identifies an open file.

int ValueoutputDescription
0stdinFd used when reading user input from the terminal.
1stdoutFd used when writing to the terminal.
2stderrFd used when writing an error to the terminal, a program which logs errors to a file.

- Static variables

Static variables are really important, they have the property of preserving their value even after they are out of their scope, preserves its previous value in its previous scope and is not initialized again.
A static int variable remains in memory while the program is running.