aaron-22766 / 42_get_next_line

Read a single line from a file descriptor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_next_line

Reading a line on a fd is way too tedious

GitHub code size in bytes Code language count GitHub top language GitHub last commit


๐Ÿ—ฃ About

This project is about programming a function that returns a line read from a file descriptor. 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. This project will not only allow you to add a very convenient function to your collection, but it will also make you learn a highly interesting new concept in C programming: static variables.

๐Ÿ› ๏ธ Usage

Requirements

The function is written in C language and thus needs the gcc compiler and some standard C libraries to run.

Instructions

1. Using it in your code

To use the function in your code, simply include its header:

#include "get_next_line.h"

and, when compiling your code, add the source files and the required flag:

get_next_line.c get_next_line_utils.c -D BUFFER_SIZE=<size>

๐Ÿ—’ Notice

Bonus for handling mulitple file descriptors at the same time was implemented using a linked list to replicate a map in order to save memory by not having to preallocate FD_MAX amount of integers.

About

Read a single line from a file descriptor


Languages

Language:C 100.0%