Giter Club home page Giter Club logo

get_next_line---lv1's Introduction

GET_NEXT_LINE (GNL)

The aim of this project is to make you code a function that returns a line ending with a newline, read from a file descriptor.

Introduction

We are allowed to use the following functions:

  • read()
  • malloc()
  • free()

Note:. The respective prototypes can be found at the bottom of this file.

Main function prototype

char *get_next_line(int fd) (newer version)

int get_next_line(int fd, char **line) (older version)

Return value

  • Read line --> correct behavior
  • NULL ---> nothing else to read or an error occurred

Compilation formula

gcc -Wall -Wextra -Werror -D BUFFER_SIZE=xx get_next_line.c get_next_line_utils.c

BUFFER_SIZE should be defined by the evaluator

Mandatory Part

Files that need to be submitted:

  • get_next_line.c
  • get_next_line_utils.c
  • get_next_line.h

Files that need to be submitted for the bonus:

  • get_next_line_bonus.c
  • get_next_line_utils_bonus.c
  • get_next_line_bonus.h

External functions

Since we can't use the libft on this project, I had to include the following functions inside the utils file.

ft_strchr, ft_strlen, ft_strdup, ft_strjoin and ft_substr

Each of these can be found inside Libft project.

Allowed external functions

ssize_t read(int fd, void *buf, size_t n_bytes) ~ ex. char *buffer; read(fd, buffer, 20); --> read 20 bytes or 20 chars

void *malloc(size_t size) ~ ex. buffer = malloc((20 + 1) * sizeof(char));

void free(void *ptr) ~ ex. free(buffer);

get_next_line---lv1's People

Contributors

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