Giter Site home page Giter Site logo

01-get_next_line's Introduction

This repository contains code developed at 42 Porto for get_next_line Project, from 11/11/2022 to 21/11/2022.

πŸ““ Subject

Click here for the subject of this project.

⚑ Function Prototype

πŸ’» Usage

1- Clone this repository:
git clone https://github.com/lbordonal/01-get_next_line.git

2- Navigate to get_next_line folder:
cd 01-get_next_line/get_next_line/

3- Compile with:
cc -Wall -Werror -Wextra ../Tests/main.c get_next_line.c get_next_line_utils.c -D BUFFER_SIZE=size

If you do not set BUFFER_SIZE, it will run with BUFFER_SIZE=42 pre-defined at get_next_line.h.

4- Run with:
./a.out


πŸ… Mandatory Part

get_next_line.c

  • get_next_line - main function.
  • read_and_save - takes the opened file descriptor and saves on a "buffer" variable what readed from it.
  • get_line - extract the first line of the file.
  • ft_save - stores the updated file with whatever is left from the original file, except the line extracted.

get_next_line_utils.c

  • ft_strlen - find length of string.
  • ft_strchr - find first occurence of a character in string.
  • ft_strjoin - concatenate two strings into a new string using malloc to alocate memory.
  • ft_calloc - allocates memory for an array with '/0'.

get_next_line.h

πŸ† Bonus Part

get_next_line_bonus.c

  • get_next_line - main function with bonus part.
  • read_and_save - takes the opened file descriptor and saves on a "buffer" variable what readed from it.
  • get_line - extract the first line of the file.
  • ft_save - stores the updated file with whatever is left from the original file, except the line extracted.

get_next_line_utils_bonus.c

  • ft_strlen - find length of string.
  • ft_strchr - find first occurence of a character in string.
  • ft_strjoin - concatenate two strings into a new string using malloc to alocate memory.
  • ft_calloc - allocates memory for an array with '/0'.

get_next_line_bonus.h

πŸ“ Tester




This work is published under the terms of 42 Unlicense.

01-get_next_line's People

Contributors

lbordonal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

01-get_next_line's Issues

main.c

Alterar:
while(line=get_next_line(fd))
{
printf(...);
free(line);
}

Deve resolver o problema do line X = null quando termina as linhas com conteΓΊdo.

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.