Skip to content

This project is about programming a function that returns a line read from a file descriptor.

License

Notifications You must be signed in to change notification settings

pix3l-p33p3r/get_next_line

Repository files navigation

Get_next_line 1337's PROJECT :


Final score

cado-car's

In this repo you will find all the codes developed during the get_next_line 1337's project, both mandatory's part and bonus part.


cado-car's


Mandatory

Calling the function get_next_line in a loop will then allow you to read the text available on the file descriptor one line at a time until the end of it. The function should return the line that has just been read. If there is nothing else to read or if an error has occurred it should return NULL.


Bonus

To succeed get_next_line with a single static variable. 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


The project

Header files :

Mandatory :

	MANDATORY ALGORITHM :

	GET_NEXT_LINE

	DESCRIPTION :
	Write a function which returns a line read from a
	file descriptor.

	RETURN VALUES :

	Read line: correct behavior.
	NULL: nothing else to read or an error occurred.

🔧 Nothing but libft functions !


ℹ️ This repository contains two versions of get_next_line, both works flawlessly.

Usage

Requirements

get_next_line requires gcc compiler and some standard libraries.

Instructions

Clone this repository in your local computer:

git clone https://github.com/pix3l-p33p3r/get_next_line.git

To use the library in your code you will need to include the header:

#include "get_next_line.h"

or

#include "get_next_line_bonus.h"

To compile the program, use these flags:

Make sure to change the XX after BUFFER_SIZE to the buffer size you want the program to work with.

gcc -Wall -Wextra -Werror -D BUFFER_SIZE=XX path/to/main_function.c path/to/get_next_line.c path/to/get_next_line_utils.c -I path/to/get_next_line.h 

About

This project is about programming a function that returns a line read from a file descriptor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages