GithubHelp home page GithubHelp logo

42_get_next_line's Introduction

42_GET_NEXT_LINE ↩️

Reading a line from a fd is way too tedious.

About ✍

This project is part of the Rank 01 from 42 Common Core and focuses on creating a function designed to read a single line, delimited by a newline character, by accepting a file descriptor as a parameter. It offers a dynamic and efficient solution for processing and retrieving lines from diverse input sources, including files. When called in a loop, get_next_line returns all the contents of the file, one line at a time until the end of the file is reached. Also, this function works with any size of buffer size specified (as the subject asks).

Prototype 🖥️

char	*get_next_line(int fd);
  • fd -> File descriptor indicating the source to read the line from.

Challenges and Learning Objectives 🧠

  • Static Variable Implementation: Through this project, we gained valuable insights into implementing static variables within functions, enhancing our understanding of efficient memory management and function behavior.
  • File Descriptor Implementation: We learned to effectively utilize file descriptors (fd) in our project, expanding our knowledge of handling input sources and enhancing overall program efficiency.
  • Macro Implementation: Understanding the use of macros in functions, such as defining values like BUFFER_SIZE in our header file, allowed for flexible and easily adjustable code configurations.

Grade

Norminette 💂🏻

At 42 School, we need to follow some strict rules when writing our code. These rules are described in the Norm and checked by the formidable norminette. Here are some of them:

- No for, do...while, switch, case, goto, ternary operators and variable-length arrays are allowed
- Each function must be maximum 25 lines
- One single variable declaration per line
- You can’t declare more than 5 variables per function
- You can't write more thane 5 functions per file
...

Click here to review the complete Norm document.

42_get_next_line's People

Contributors

marcelofassbinder avatar

Stargazers

Vinicius Vaccari 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.