Giter Site home page Giter Site logo

get_next_line's Introduction

Get Next Line

fr

Summary

This project aims to develop the get_next_line function, capable of reading lines with a limited buffer size from a file descriptor. This project is written in C.

Git Repository Contents

  • get_next_line.h: Header file containing the prototype of the get_next_line function.
  • get_next_line.c: Implementation of the main function.
  • get_next_line_utils.c: Utility file containing additional functions necessary for the implementation of get_next_line.

Acquired Skills

C Programming

  • Development of a complex function in the C language.
  • Adherence to the 42 School C coding standard to ensure code quality and readability.
  • Robust handling of undefined behaviors and error cases.

Compilation and Makefile

  • Makefile to automate the project compilation.
  • Use of flags -Wall, -Wextra, and -Werror.
  • Use of flags -g3 and -fsanitize=address for debugging.

Memory Management

  • Dynamic memory allocation using malloc.
  • Freeing memory once operations are completed or in case of errors to prevent leaks.
  • Use of valgrind to check for residual memory leaks.

String Handling

  • Reading and storing strings.
  • Parsing the string to check for the end of a line defined by a newline character \n or end of file EOF.
  • Reuse of the file descriptor to read the file line by line once the function is recalled, returning the remainder of the previous line if a newline is found.

Static Variables

  • Definition of a BUFFER_SIZE before compilation to set a constant buffer size.
  • Use of a static variable to store the remainder of the previous line if a newline is found.

File Handling

  • Reading lines from a file descriptor.
  • Handling various use cases, such as end of file or reading errors.
  • Multiple file descriptors handling with a constant array of strings.

get_next_line's People

Contributors

semx2a avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.