[go: nahoru, domu]

Skip to content

aaron-22766/42_get_next_line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.