{"id":21924848,"url":"https://github.com/suconbu/cini","last_synced_at":"2026-02-02T03:35:33.732Z","repository":{"id":11765699,"uuid":"70488782","full_name":"suconbu/cini","owner":"suconbu","description":"single header ini file parser for C/C++","archived":false,"fork":false,"pushed_at":"2022-06-04T16:57:37.000Z","size":103,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T15:05:59.580Z","etag":null,"topics":[],"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/suconbu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-10T13:08:45.000Z","updated_at":"2023-12-27T15:30:10.000Z","dependencies_parsed_at":"2022-08-08T15:00:03.284Z","dependency_job_id":null,"html_url":"https://github.com/suconbu/cini","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/suconbu/cini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconbu%2Fcini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconbu%2Fcini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconbu%2Fcini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconbu%2Fcini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suconbu","download_url":"https://codeload.github.com/suconbu/cini/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suconbu%2Fcini/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261896993,"owners_count":23226646,"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":[],"created_at":"2024-11-28T21:16:11.335Z","updated_at":"2026-02-02T03:35:28.694Z","avatar_url":"https://github.com/suconbu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cini - single header ini file parser for C/C++\n\nLicensed under [MIT License](https://opensource.org/licenses/MIT).\n\n# Version\n\n1.2.0\n\n# Overview\n\n* Single header\n* No third-party dependency\n* Supports array value\n\n# Sample\n\n```c\n#define CINI_IMPLEMENTATION // This definition is required in only one source file\n#include \"cini.h\"\n\nvoid sample_for_c()\n{\n    HCINI hcini = cini_create(\"sample.ini\");\n    if (cini_isgood(hcini) == 0) {\n        fprintf(stderr, \"...\");\n    }\n    int i = cini_geti(hcini, \"section-name\", \"key-name\", 0 /* default_value */);\n    float f = cini_getf(hcini, \"section-name\", \"key-name\", 0.0f);\n    const char* s = cini_gets(hcini, \"section-name\", \"key-name\", \"default\");\n    // The pointer returned by cini_gets/cini_getas is valid until the handle is released.\n    cini_free(hcini);\n}\n\nvoid sample_for_cpp()\n{\n    Cini cini(\"sample.ini\");\n    if (!cini) {\n        std::cerr \u003c\u003c \"...\" \u003c\u003c std::endl;\n    }\n    int i = cini.geti(\"section-name\", \"key-name\", 0 /* default_value */);\n    float f = cini.getf(\"section-name\", \"key-name\", 0.0);\n    const char* s = cini.gets(\"section-name\", \"key-name\", \"default\");\n}\n```\n\n# Supported ini file format\n\n* The new-line character is LF (0x0A) or CRLF (0x0D, 0x0A).\n* Allow blank line.\n* Lines beginning with \"`;`\" or \"`#`\" are considered comment lines.\n* Case sensitive in key-name and section-name.\n* Ignores space-character (0x09, 0x0A, 0x0B, 0x0C, 0x0D and 0x20) around key-name, section-name and value.\n* Allow to write the entry on out of the section.\n* If duplicate the key-name, first one will be use.\n* If duplicate the section-name, merge the entries in each sections.\n\n# Data types\n\nThe cini supports the following data-types.\n\n* String\n* Numeric\n\n## Data types - String\n\n* Quotation marks (\"`\"`\" or \"`'`\") are optional, but their use allows you to include whitespace at around of a string, or to include the array element delimiter \"`,`\" in a string.\n* Numerical values can also be obtained as string.\n* \"`\\`\" is not recognized as an escape character.\n\nini file:\n```\n[String example]\nstr1 = One\nstr2 = 123\nstr3 = \" Two, Three \"\nstr4 = ' Four \\t Five \\n'\nstr5 = \"Six, \"Seven\"\"\n```\n\nCode:\n```\ncini_gets(hcini, \"String example\", \"str1\", \"default\");      // \"One\"\ncini_gets(hcini, \"String example\", \"str2\", \"default\");      // \"123\"\ncini_gets(hcini, \"String example\", \"str3\", \"default\");      // \" Two, Three \"\ncini_gets(hcini, \"String example\", \"str4\", \"default\");      // \" Four \\t Five \\n\"\ncini_gets(hcini, \"String example\", \"str5\", \"default\");      // \"Six, \"Seven\"\"\n```\n\n## Data types - Numeric\n\n* The cini can use decimal and hexadecimal numbers.\n* If an attempt is made to retrieve a value that cannot be interpreted as a number using a function for numeric (such as \"cini_geti\"), the attempt will fail and the default value specified in the argument will be returned.  \n\nini file:\n```\n;sample.ini\n\n[Decimal example]\ndec1 = 123\ndec2 = -4.56\ndec3 = .123\ndec4 = 7.89e2\ndec5 = One\n\n[Hexadecimal example]\nhex1 = 0xFF\nhex2 = #FF\n```\n\nCode:\n```c\ncini_geti(hcini, \"Decimal example\", \"dec1\", -1);        // 123\ncini_getf(hcini, \"Decimal example\", \"dec1\", -1.0f);     // 123.0\ncini_geti(hcini, \"Decimal example\", \"dec2\", -1);        // -4\ncini_getf(hcini, \"Decimal example\", \"dec2\", -1.0f);     // -4.55999994\ncini_geti(hcini, \"Decimal example\", \"dec3\", -1);        // 0\ncini_getf(hcini, \"Decimal example\", \"dec3\", -1.0f);     // 0.123000003\ncini_geti(hcini, \"Decimal example\", \"dec4\", -1);        // 789\ncini_getf(hcini, \"Decimal example\", \"dec4\", -1.0f);     // 789.0\ncini_geti(hcini, \"Decimal example\", \"dec5\", -1);        // -1\ncini_getf(hcini, \"Decimal example\", \"dec5\", -1.0f);     // -1.0\ncini_geti(hcini, \"Hexadecimal example\", \"hex1\", -1);    // 255\ncini_getf(hcini, \"Hexadecimal example\", \"hex1\", -1.0f); // 255.0\ncini_geti(hcini, \"Hexadecimal example\", \"hex2\", -1);    // 255\ncini_getf(hcini, \"Hexadecimal example\", \"hex2\", -1.0f); // 255.0\n```\n\n# Array\n\nThe cini recognizes comma-separated values as an array, and values can be retrieved by specifying an index.\n\n* You can mix different data types in a single array\n* To include \"`,`\" in a string, enclose both ends of the string with \"`\"`\" or \"`'`\".\n\nini file:\n```\n[Array example]\narray1 = 1, 0x2, #3, 4.56, Seven\narray2 = One,\"Two,Three\",'Four,Five'\n```\n\nCode:\n```c\ncini_getcount(hcini, \"Array example\", \"array1\");            // 5\ncini_getai(hcini, \"Array example\", \"array1\", 0, -1)         // 1\ncini_getai(hcini, \"Array example\", \"array1\", 4, -1)         // -1\ncini_gets(hcini, \"Array example\", \"array1\", \"default\")      // \"1, 0x2, #3, 4.56, Seven\"\ncini_getcount(hcini, \"Array example\", \"array2\");            // 3\ncini_getas(hcini, \"Array example\", \"array2\", 1, \"default\")  // \"Two,Three\"\ncini_gets(hcini, \"Array example\", \"array2\", \"default\")      // \"One,\"Two,Three\",'Four,Five'\"\n```\n\n# Limitations\n\n| Item                                                        | Value    | Definition            |\n| ----------------------------------------------------------- | -------- | --------------------- |\n| Maximum number of bytes per line (Including null character) | 512bytes | CINI_LINE_BUFFER_SIZE |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuconbu%2Fcini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuconbu%2Fcini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuconbu%2Fcini/lists"}