Minimal library that provides dynamic strings using plain C99. Convenience macros are also provided if GNU C is used.
Go to file
Xavier Del Campo Romero 7be16e6e5c
CMakeLists.txt: Fix missing parameter names
VERSION must be indicated when passing a version string to project().
Also, LANGUAGES must be also be passed when the language name is not the
only argument to project() (apart from the project name itself).
2023-11-10 14:43:39 +01: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 CMakeLists.txt: Fix missing parameter names 2023-11-10 14:43:39 +01:00
dynstr.c dynstr.c: Fix memory leak if realloc(3) fails 2023-03-08 01:21:16 +01:00
dynstr.pc Install .pc file 2023-10-16 00:38:06 +02:00
LICENSE First commit 2020-03-19 18:40:31 +01:00
Makefile Makefile: Set -O1 2023-10-25 22:06:23 +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.