Skip to content

falzfalzfalz/get_next_line_shp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get_next_line @ 42

After finishing libft, get next line is the second mandatory project, requiring us to make a function reading line by line from a file descriptor, like the terminal command cat.

Usage

char *line;

// To get a single line
get_next_line(fd, &line);
...
ft_strdel(&line); // You should free after you're done using your line

// To read a whole file
while (get_next_line(fd, &line))
{
	// process the line here, here we'll just output it
	ft_putstr(line);

	// free the line to avoid leaking memory
	ft_strdel(&line);
}

// GNL will automatically free appropriately whenever it reaches EOF.

About

Read line by lien from a file descriptor, like cat.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages