https://github.com/tekknolagi/fmt
Small C string formatting library
https://github.com/tekknolagi/fmt
c formatting library single-header string
Last synced: about 1 year ago
JSON representation
Small C string formatting library
- Host: GitHub
- URL: https://github.com/tekknolagi/fmt
- Owner: tekknolagi
- License: mit
- Created: 2022-05-19T08:02:04.000Z (about 4 years ago)
- Default Branch: trunk
- Last Pushed: 2022-05-31T06:38:32.000Z (about 4 years ago)
- Last Synced: 2025-02-10T05:42:01.322Z (over 1 year ago)
- Topics: c, formatting, library, single-header, string
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [fmt](https://github.com/tekknolagi/fmt)
This very small formatting library provides two functions and a data type for
when you need to heap-allocate and format a string at once. You could try and
remember exactly how to do that dance, or you could include `fmt.h` and go on
your way.
```c
// NUL-terminated string and length. Length does not include NUL.
typedef struct str_size {
char *str;
size_t length;
} str_size;
str_size format(const char *fmt, ...);
str_size formatv(const char *fmt, va_list args);
void str_size_free(str_size str); // or you can free(str.str)
```
Happy hacking.