jos-felipe / get_next_line

This project is about programming a function that returns a line read 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


💡 About the project

The aim of this project is to make you code a function that returns a line, read from a file descriptor. 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>

📋 Testing

You only have to edit the main.c file, test files are inside tests/, you can edit test files to put another text if you wish to test othe cases. Then simply run this command:

gcc -Wall -Werror -Wextra -D BUFFER_SIZE=42 get_next_line.c get_next_line_utils.c main.c && ./a.out

Or you can also use this third party tester to fully test the project

About

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


Languages

Language:C 100.0%