Coder Social home page Coder Social logo

42cursus-getnextline's Introduction

42cursus-getnextline

Norm v3 ver.

日本語

概要

  • メモリーリーク厳禁!!
  • ファイルを一行ずつ読み込む
  • 読み込み可能なバッファーサイズを可変長で可能である。
  • 読み込み時にエラーが何かしらのエラーが出た場合、返り値=-1
  • 読み込み行に改行がある(最後の行ではない)場合、返り値=1
  • 読み込み行にナル文字(最後の行である)場合、もしくは読み込むものがない場合(EOF)だった場合、返り値=0
  • *bonus.c / *bonus.hは、いくつものファイル読み込み(ファイルディスクリプタの考慮)に対応している。

※ todolits.txtに*bonus.cで私が考慮している箇所を記述している。

コンパイル方法

gcc -Wall -Wextra -Werror main_bonus.c get_next_line_bonus.c get_ext_line_utils_bonus.c -D BUFFER_SIZE=xx

また、main_bonus.c get_next_line.c get_next_line_utils.c ファイルでコンパイルすると、ファイルディスクリプタが考慮できていないことが確認できる。

English

Summary

  • Strictly no memory leaks!
  • Reads files line by line.
  • Variable length buffer size is possible for reading.
  • If there is some kind of error when reading, return value = -1.
  • If there is a newline in the read line (not the last line), return value = 1
  • If there is a null character in the line to be read (it is the last line), or if there is nothing to read (EOF), return value = 0
  • *bonus.c / *bonus.h supports a number of file reads (considering file descriptors).

※ todolits.txt describes the parts of *bonus.c that I take into account.

How to compile

gcc -Wall -Wextra -Werror main_bonus.c get_next_line_bonus.c get_ext_line_utils_bonus.c -D BUFFER_SIZE=xx

Also, if you compile with the main_bonus.c get_next_line.c get_next_line_utils.c file, you can see that the file descriptors are not taken into account.

pic-1

42cursus-getnextline's People

Contributors

yuki-katayama avatar

Stargazers

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