Minimal library that provides dynamic strings using plain C99. Convenience macros are also provided if GNU C is used.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Xavier Del Campo Romero 5c13c9b838
Support POSIX make(1) as build system
1 day ago
include Update copyright notice 3 months ago
.gitignore Support POSIX make(1) as build system 1 day ago
CMakeLists.txt Added license notice to CMakeLists.txt, used PROJECT_NAME 3 years ago
LICENSE First commit 3 years ago
Makefile Support POSIX make(1) as build system 1 day ago
README.md Updated README.md with dynstr_prepend example 3 years ago
dynstr.c dynstr.c: Fix memory leak if realloc(3) fails 3 months ago

README.md

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.