{"id":18337762,"url":"https://github.com/pin3dev/42_getnextline","last_synced_at":"2025-07-24T19:05:06.891Z","repository":{"id":259537709,"uuid":"578384999","full_name":"pin3dev/42_GetNextLine","owner":"pin3dev","description":"A function that reads and returns a single line from a file descriptor, efficiently handling large inputs. This project sharpens skills in dynamic memory allocation, buffer management, and system-level file operations in C programming.","archived":false,"fork":false,"pushed_at":"2024-10-24T23:28:10.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T20:18:36.961Z","etag":null,"topics":["42-cursus","42-get-next-line","42-gnl","42projects","42school","buffer-overflow","file-descriptors","io","memory-management"],"latest_commit_sha":null,"homepage":"https://github.com/pin3dev/42_Cursus/blob/68d9f9df36b61a49f1275dcf25ebdc91df19da3c/assets/GetNextLine/Rdm/getNextLine_en.subject.pdf","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/pin3dev.png","metadata":{"files":{"readme":"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":"2022-12-14T23:37:37.000Z","updated_at":"2024-10-24T23:28:13.000Z","dependencies_parsed_at":"2024-10-26T10:11:56.955Z","dependency_job_id":"621f2a64-50be-41f7-9280-db5ee8f1224e","html_url":"https://github.com/pin3dev/42_GetNextLine","commit_stats":null,"previous_names":["pin3dev/42_getnextline"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pin3dev/42_GetNextLine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_GetNextLine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_GetNextLine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_GetNextLine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_GetNextLine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pin3dev","download_url":"https://codeload.github.com/pin3dev/42_GetNextLine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_GetNextLine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266890310,"owners_count":24001526,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["42-cursus","42-get-next-line","42-gnl","42projects","42school","buffer-overflow","file-descriptors","io","memory-management"],"created_at":"2024-11-05T20:12:12.528Z","updated_at":"2025-07-24T19:05:06.839Z","avatar_url":"https://github.com/pin3dev.png","language":"C","readme":"\u003ch1 align=\"center\"\u003eGetNextLine\u003c/h1\u003e\n\u003cp align=\"center\"\u003e \n  \u003cimg src=\"https://img.shields.io/badge/grade-125%2F125-yellow?style=for-the-badge\u0026logo=42\u0026labelColor=gray\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Cursus/tree/main/library/#00-Get_Next_Line\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/File_IO-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Memory_Management-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Static_Variables-blue?style=for-the-badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3\u003e\n  \u003cp align=\"center\"\u003e \n    \u003ca href=\"#introduction\"\u003eIntroduction\u003c/a\u003e • \n    \u003ca href=\"#structure\"\u003eStructure\u003c/a\u003e • \n    \u003ca href=\"#docs\"\u003eDocs\u003c/a\u003e • \n    \u003ca href=\"#cloning\"\u003eCloning\u003c/a\u003e • \n    \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e • \n    \u003ca href=\"#norms\"\u003eNorms\u003c/a\u003e • \n    \u003ca href=\"#theoretical\"\u003eTheoretical\u003c/a\u003e   \n  \u003c/p\u003e\n\u003c/h3\u003e\n\n## 🗣️ Introduction \u003ca id=\"introduction\"\u003e\u003c/a\u003e\n\nThe **Get Next Line** project focuses on reading a file line by line efficiently, which is a common task in many applications. The goal of this project is to write a function that returns the next line from a file descriptor, handling various edge cases such as multiple file descriptors, varying buffer sizes, and memory management.\n\nThe main challenge of the project is to ensure that the function handles both large and small files while managing memory efficiently, and avoiding memory leaks or overflows.\n\n## 🧬 Project Structure \u003ca id=\"structure\"\u003e\u003c/a\u003e\n\nThe function relies on a few key concepts. **File descriptors** are used to reference files or input/output streams, while **static variables** are necessary to maintain values between function calls. **Buffers** are used to temporarily store data read from the file descriptor, ensuring smooth data flow. Proper **memory management** is also essential to avoid memory leaks by ensuring memory is allocated and freed correctly.  \n\n## 🗃️ Documentation \u003ca id=\"docs\"\u003e\u003c/a\u003e\n\nFor detailed documentation on the **get_next_line** function, including example usages and edge cases, visit the following link:\n\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Get_Next_Line/wiki\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/GetNextLine_Docs-lightgreen?style=for-the-badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## 🫥 Cloning the Repository \u003ca id=\"cloning\"\u003e\u003c/a\u003e\n\nTo clone this repository and compile the project, run the following commands:\n\n```bash\ngit clone https://github.com/pin3dev/42_GetNextLine.git\ncd 42_GetNextLine\n```\nThis will download the project from GitHub to your local machine. Once inside the directory, you can compile the project with the provided Makefile.\n\n## 🕹️ Compilation and Usage \u003ca id=\"usage\"\u003e\u003c/a\u003e\n\n### Makefile\n\nThe project includes a `Makefile` to streamline the compilation process. The available rules are:\n\n- `all`: Compiles the project.\n- `clean`: Removes object files.\n- `fclean`: Removes object files and the executable.\n- `re`: Recompiles the entire project from scratch.\n\nTo compile the project, simply run:\n```bash\nmake\n```\nThis will generate the necessary files and allow you to link the function into your project.\n\n### Basic Usage\n\nTo use the **get_next_line** function in your program:\n\n1. Include the header file in your code:\n    ```c\n    #include \"42_GetNextLine/gnl/inc/get_next_line.h\"\n    ```\n\n2. Compile your code along with the **get_next_line** files:\n    ```bash\n    cc -Wall -Wextra -Werror -o your_exec test.c -L 42_GetNextLine/gnl/ -lgnl -L 42_Libft/libft/ -lft\n    ```\n\n3. You can now call `get_next_line` to read a file line by line.\n   \n    ```c\n    int fd = open(\"file.txt\", O_RDONLY);\n    char *line;\n  \n    while ((line = get_next_line(fd)) != NULL)\n    {\n        printf(\"%s\\n\", line);\n        free(line); // Make sure to free the line after use.\n    }\n    close(fd);\n    return 0;\n    ```\n\n## ⚠️ Norms and Guidelines Disclaimer \u003ca id=\"norms\"\u003e\u003c/a\u003e\n\nThis project adheres ***partially*** to the strict coding guidelines of the [**42 School Norm**](https://github.com/pin3dev/42_Cursus/blob/b9cd0fe844ddb441d0b3efb98abcee92aee49535/assets/General/norme.en.pdf). This includes coding restrictions like a maximum number of functions per file, limited lines per function, and other stylistic rules which may impact implementation decisions.\n\n## 📖 Theoretical Background \u003ca id=\"theoretical\"\u003e\u003c/a\u003e\n\nAll the theoretical material used to develop this project is organized and can be accessed directly via the link below:  \n\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Cursus/tree/main/get_next_line/#00-Get_Next_Line\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/GetNextLine_Library-gray?style=for-the-badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpin3dev%2F42_getnextline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpin3dev%2F42_getnextline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpin3dev%2F42_getnextline/lists"}