Skip to content

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

License

Notifications You must be signed in to change notification settings

lbordonal/01-get_next_line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages