Get Next Line
This is my get_next_line.
Functions
ft_memcpy
void *ft_memcpy(void *dst, const void *src, size_t len);
Description
memcpy() function copies n bytes from memory area src to memory area dst.
Return value
Returns the amount of characters copied.
ft_strcpy
int ft_strcpy(char *dst, char *src);
Description
ft_strcpy() copies the string src into the string dst.
Return value
Returns the amount of characters copied.
ft_strchr
char *ft_strchr(char *s, char c);
Description
ft_strchr() search the first occurrence of the character c in the string s.
Return value
Returns the first occurrence of the character c in the string s or 0 if there's no ocurrence.
ft_get_aux
char *ft_get_aux(int fd);
Description
ft_get_aux() tryes to gets from a list the struct corresponding to the entered fd.
Return value
Returns the struct that corresponds to the entered fd or returns NULL on falure.
ft_buffprocesor
static int ft_buffprocesor(int fd, char *str);
Description
ft_buffprocesor() attempts to read up to BUFFER_SIZE characters from a file descriptor fd into str and, if there is any '\n', saves the extra string into an aux array. If the aux array has a value while calling the function it will do the same but taking the buffer from the aux array instead the file.
Return value
Returns the amount of characters on the string not including the ones on the aux variable.
ft_createstr
static char *ft_createstr(int len);
Description
ft_createstr() tries to create a string of the size len.
Return value
Returns an empty string of size en or, on failure, returns 0.
ft_assembler
char *ft_assembler(int fd);
Description
ft_assembler() function attempts read the necesary characters from the file descriptor fd and returns them as a new string, saving the characters after the '\n' on a list with a struct for each file descriptor.
It doesent check if the BUFFER_SIZE is > to 0 and fd >= 0;
Return value
Returns the next line of the chosen file descriptor as a new string.
get_next_line
char *get_next_line(int fd);
Description
get_next_line() function attempts read the necesary characters from the file descriptor fd and returns them as a new string, saving the characters after the '\n' on a list with a struct for each file descriptor.
Return value
Returns the next line of the chosen file descriptor as a new string.