Skip to content

This projects is the second project of école 42 - sp

Notifications You must be signed in to change notification settings

gabrielasertori/Get-next-line

 
 

Repository files navigation

Get Next Line - GNL

This project is part of école 42 projects.

🗒️ About

get_next_line(int fd) function read from a file descriptor and print on the screen the result with the \n if there is any.
The read function, from unistd.io library, read a certain amount of bytes from the passed file descriptor. These bytes are passed as BUFFER_SIZE at the compile time.
The expected behaviour is that the function must read and return BUFFER_SIZE bytes until a \n or end of file (EOF), and must keep remaining bytes (if there is any) for a possible second call (or many other calls until EOF).

⌨️ How to compile it

clang -D BUFFER_SIZE=5 get_next_line.c get_next_line_utils.c main.c -I. && ./a.out

  • The get_next_line.c has the main function.
  • The get_next_line_utils.c has auxiliary functions.
  • The get_next_line.h has the header with the prototypes of utils.
  • main.c has the test.
  • -D means that you want to define a macro named...
  • BUFFER_SIZE macro determines how many bytes the read function will read from a file descriptor (if = 0 the return value will be null).
  • I. include where is the .h header (in this case, at the same directory that the others). If ommited then you have to write the get_next_line.h file.

⭐ Bonus part

GNL version 10 hasn't many bonus part. The instructions are:

  • Read from various file descriptors at the same time.
  • Use only one static variable.

The standard code already has the bonus part included, it was write considering the above rules.

🤝 Contributors

The collab:

Gabi sertori avatar
Gabi Sertori
Lucas krebs avatar
Lucas Krebs

📮 Contact

Please, if you encounter any bug, errors or have any tips, feel free to make contact. Open an issue here with the title [bug], [problem], [sugestion] or [update] and describe the issue.

About

This projects is the second project of école 42 - sp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%