1
0
Fork
You've already forked dynstr
0
Minimal library that provides dynamic strings using plain C99.
  • C 76.9%
  • Makefile 13.6%
  • CMake 9.5%
Find a file
2026年04月05日 13:00:20 +02:00
include Update copyright notice 2023年03月08日 01:18:47 +01:00
.gitignore Makefile: Build dynstr also as a shared library 2023年10月25日 21:47:34 +02:00
CMakeLists.txt Bump to version 0.1.1 2026年04月05日 13:00:20 +02:00
dynstr.c dynstr.c: Fix memory leak if realloc(3) fails 2023年03月08日 01:21:16 +01:00
dynstr.pc Bump to version 0.1.1 2026年04月05日 13:00:20 +02:00
LICENSE First commit 2020年03月19日 18:40:31 +01:00
Makefile Bump to version 0.1.1 2026年04月05日 13:00:20 +02:00
README.md Updated README.md with dynstr_prepend example 2020年08月04日 20:01:11 +02:00

dynstr

Minimal library that provides dynamic strings using plain C99. Convenience macros are also provided if GNU C is used.

Usage

#include <stdio.h>
#include "dynstr.h"
int main(const int argc, const char *argv[])
{
 struct dynstr s;
 dynstr_init(&s);
 dynstr_append(&s, "Hello");
 dynstr_append(&s, " from %s:%d\n", __func__, __LINE__);
 dynstr_prepend(&s, "Hey! ");
 printf("%s", s.str);
 dynstr_free(&s);
 return 0;
}

Output:

Hey! Hello from main:10

License

See LICENSE file.