Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maksim2498/c-int-fmt
A small C99 library for integer parsing and formatting
https://github.com/maksim2498/c-int-fmt
c c99 formatting integer library parsing
Last synced: 4 days ago
JSON representation
A small C99 library for integer parsing and formatting
- Host: GitHub
- URL: https://github.com/maksim2498/c-int-fmt
- Owner: Maksim2498
- License: mit
- Created: 2023-05-15T13:22:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-18T13:41:09.000Z (over 1 year ago)
- Last Synced: 2024-11-20T13:17:01.490Z (2 months ago)
- Topics: c, c99, formatting, integer, library, parsing
- Language: C
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# IntStr
## Index
- [Index](#index);
- [About](#about);
- [Examples](#examples);
- [Building](#building);
- [Installation](#installation);
- [Documentation](#documentation).## About
This is a small C99 library for integer parsing and formatting.
Parsing and fomratting functions work in stream-mode, i.e. they
accept `read` and `write` callback functions as arguments and hence
can work with any kind of character streams such as files and strings.Out of the box there are special versions of parse and format
functions with `_file`, `_str` and `_str_n` suffixes which handle
files, strings and strings of specified size respectively.## Examples
__Code:__
```c
#include#include
int main() {
mint_fmt_file(2498, stdout, NULL);putchar('\n');
struct mint_fmt_opts opts = MINT_FMT_OPTS_DEFAULT;
opts.group_sep = "_";
opts.group_size = 3;
opts.plus = MINT_PLUS_SIGN;mint_fmt_file(2498000, stdout, &opts);
putchar('\n');
}
```__Output:__
```console
2498
+2_498_000
```## Building
For building and installing a library you must have [CMake](https://cmake.org/) installed.
First, configure a project running the following command in terminal:
```console
cmake -B build -S .
```Then if you want to build it as a shared library run the following command:
```console
cmake -DBUILD_SHARED_LIBS=ON build
```And finally build a library with the following command:
```console
cmake --build build
```## Installation
Before installing you must first [build](#building) a library.
If library is already built go to the project's root folder and run the following command in terminal:
```console
cmake --install build
```## Documentation
You can wether use [online documentation](https://docs.intstr.fominmv.ru) or build it locally.
To build documentation locally you must have [Doxygen](https://www.doxygen.nl/) installed.
When it's installed go to the project's root folder and run the following command in the terminal:
```console
doxygen
```After this you will have a documentaion build in the `/docs` folder.