Skip to content

NEIL-smtg/get_next_line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📖 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.

You will understand how files are opened, read and closed in an OS,
and how they are interpreted by a programming language for further analysis.
This task is crucial to understand for a future programmer since much of the time is based
on manipulating files for data management and persistence.
This project consists of coding a function that returns one line at a time from a text file.

For more detailed information, look at the subject of this project.

🛠️ 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 can edit any of the text files or the main.c for further testing. If you are not specifying the BUFFER_SIZE in your terminal, the default value of BUFFER_SIZE will be set as 10. If you tempt to change the value of BUFFER_SIZE, simply run this command (change "xx" with desired buffer size, e.g. BUFFER_SIZE=9999) :

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

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages