{"id":18994868,"url":"https://github.com/jweinst1/smelt","last_synced_at":"2025-08-24T13:32:47.537Z","repository":{"id":97724165,"uuid":"146369111","full_name":"jweinst1/Smelt","owner":"jweinst1","description":"A simple, fast CSV parsing library in C","archived":false,"fork":false,"pushed_at":"2018-11-21T20:55:24.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T15:43:29.170Z","etag":null,"topics":["c","csv","csv-import","csv-parser","csv-reading"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jweinst1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-08-28T00:20:57.000Z","updated_at":"2019-02-05T12:32:48.000Z","dependencies_parsed_at":"2023-07-06T10:15:29.289Z","dependency_job_id":null,"html_url":"https://github.com/jweinst1/Smelt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jweinst1%2FSmelt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jweinst1%2FSmelt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jweinst1%2FSmelt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jweinst1%2FSmelt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jweinst1","download_url":"https://codeload.github.com/jweinst1/Smelt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240010211,"owners_count":19733514,"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":["c","csv","csv-import","csv-parser","csv-reading"],"created_at":"2024-11-08T17:27:21.565Z","updated_at":"2025-02-21T11:49:04.986Z","avatar_url":"https://github.com/jweinst1.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smelt\n\n*A single header CSV library in C*\n\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/jweinst1/Smelt/blob/master/LICENSE.md)\n![language button](https://img.shields.io/badge/Language-C-orange.svg)\n![build button](https://img.shields.io/badge/Build-passing-green.svg)\n\n## Intro\n\nSmelt is a C-library for parsing and saving CSV files and data. Smelt is a compact, single header library under 500 lines of code. It's cross platform, and easier to include in almost any project. Smelt also comes as a shared library with a different header for linking into projects. With `LibSmelt`, the shared library version of Smelt, it can also be called from other languages like Python.\n\n## Building\n\nIf you just want to use the header version of `Smelt`, feel free to drop `include/Smelt.h` into your project.\n\nTo build the `/build` directory, on unix, you can run the shell script at `scripts/build.sh`. This will build the shared library of Smelt as well as copy the single header and shared library header to the `/build` directory.\n\nInstead, you can also build directly with cmake\n\n```\n$ mkdir -p build\n$ cmake ..\n$ make\n```\n\n\n### Running Tests\n\nThe `Smelt` library is throughly tested to ensure maximum quality. If you would like to run the unit tests, run the shell script at `scripts/testrun.sh`. Alternatively, you can follow the steps below\n\n```\n$ mkdir -p build\n$ cmake ..\n$ make\n$ ./SmeltHeaderTests\n$ ./SmeltLibTests\n```\n\nThe lib tests contain tests for the functions exposed via the shared library and the header tests contain tests for all the smaller, lower level functions in the single header distribution.\n\n## Usage\n\n`Smelt` is a straight forward, easy to use CSV library for the C language. For performance critical tasks, you can also call `Smelt` functions from languages like Python. Smelt contains a public API, functions that are exposed to the shared library and start with `Smelt_`, as well as a full API which includes smaller, `static` functions. Overall, the public API is more simplified and good for general use cases.\n\n### Parsing a string:\n\nThis functions parses a c string into a `smelt_table_t*`:\n\n```c\nsmelt_table_t*\nSmelt_parse_string(const char* csv);\n```\n\n### Parsing a file:\n\nThis function parses the file content at a specified path into a `smelt_table_t*`:\n\n```c\nsmelt_table_t*\nSmelt_parse_file(const char* path);\n```\n\n### Saving to file:\n\nThis function writes the table to a file at `path`. It accepts a C file mode, so you can append to an existing CSV file or write to the beginning of a file.\n\n```c\nint\nSmelt_to_file(smelt_table_t* table, const char* path, const char* mode);\n```\n\n### Setting and Getting Data\n\nThe following functions allow you to access and change data anywhere in the `smelt_table_t*` structure capsule.\n\n```c\nsmelt_row_t*\nSmelt_get_row(smelt_table_t* table, size_t index);\n\nsmelt_item_t*\nSmelt_get_item(smelt_table_t* table, size_t row, size_t col);\n\nint\nSmelt_set_item_str(smelt_table_t* table, \n\t               size_t x, \n\t               size_t y, \n\t               const char* value,\n\t               size_t slice);\n\nint\nSmelt_set_item_int(smelt_table_t* table, \n\t               size_t x, \n\t               size_t y, \n\t               const int value);\n```\n\n### Printing\n\nYou can print your smelt parsed table with this function:\n\n```c\nvoid\nSmelt_print_table(smelt_table_t* table);\n```\n\n## License\n\n`Smelt` is fully MIT licensed. Please maintain a copy of the MIT license of the repo in any distribution you intend to use it in.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjweinst1%2Fsmelt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjweinst1%2Fsmelt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjweinst1%2Fsmelt/lists"}