{"id":28042323,"url":"https://github.com/nabilac27/42-get_next_line","last_synced_at":"2025-05-11T14:26:08.353Z","repository":{"id":267202638,"uuid":"900531502","full_name":"nabilac27/42-get_next_line","owner":"nabilac27","description":"get_next_line is a C function that reads and returns a single line from a file descriptor, utilizing a static buffer to manage data across multiple calls","archived":false,"fork":false,"pushed_at":"2025-04-10T02:16:45.000Z","size":1563,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T03:25:01.611Z","etag":null,"topics":["buffer-management","error-handling","file-descriptor","memory-management","static-variables","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nabilac27.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-09T01:35:14.000Z","updated_at":"2025-04-10T02:16:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"e68a662e-0b03-4e6e-8de8-a247b4711842","html_url":"https://github.com/nabilac27/42-get_next_line","commit_stats":null,"previous_names":["nabilac27/get_next_line","nabilac27/42-get_next_line"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-get_next_line","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-get_next_line/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-get_next_line/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-get_next_line/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabilac27","download_url":"https://codeload.github.com/nabilac27/42-get_next_line/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253578779,"owners_count":21930599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buffer-management","error-handling","file-descriptor","memory-management","static-variables","string-manipulation"],"created_at":"2025-05-11T14:26:07.847Z","updated_at":"2025-05-11T14:26:08.341Z","avatar_url":"https://github.com/nabilac27.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **get_next_line**\n\nThis repository contains my implementation of the **get_next_line** function, which reads and returns a single line from a file descriptor, including the newline character (if present).\n\n## **Key Concepts**\n\n- **Dynamic Memory Management**: The function uses only `read`, `malloc`, and `free` to manage memory efficiently.\n  \n- **Efficient Chunk Reading**: It reads data in chunks, defined by `BUFFER_SIZE`, and handles cases like the end of a file or an empty file.\n\n- **Multiple File Descriptors**: Supports multiple file descriptors and keeps track of the state of each one separately.\n\n## **Bonus: Multiple File Descriptors**\nThis implementation handles multiple files at once, maintaining the state of each file descriptor independently.\n\n---\n\n## **Functions Overview**\n\n| **Function**                          | **Description** |\n|---------------------------------------|-----------------|\n| `get_next_line(int fd)`               | Reads and returns a single line from the file descriptor `fd`. |\n| `read_into_buffer(char *buffer, int fd)` | Reads data from the file descriptor into the buffer. |\n| `next_line(char buffer[])`            | Extracts the next line from the buffer. |\n| `clear_buffer(char buffer[])`         | Clears the buffer after reading a line. |\n| `ft_strjoin(char *s1, char *s2)`      | Concatenates two strings `s1` and `s2` into a new string. |\n| `ft_strchr(const char *ptr_string, int ptr_find)` | Finds the first occurrence of `ptr_find` in `ptr_string`. |\n| `ft_strlen(const char *str)`          | Returns the length of `str`. |\n| `ft_strlcpy(char *dst, const char *src, int dstsize)` | Copies `src` into `dst` ensuring it doesn't exceed `dstsize`. |\n| `ft_strjoin_free(char *s1, char *s2)` | Joins `s1` and `s2` and frees `s1`. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-get_next_line","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabilac27%2F42-get_next_line","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-get_next_line/lists"}