midokura / dynstr

Fork of a dynamic C strings library

Home Page:https://gitea.privatedns.org/xavi/dynstr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Fork of a dynamic C strings library

https://gitea.privatedns.org/xavi/dynstr

License:Apache License 2.0


Languages

Language:C 79.5%Language:Makefile 12.6%Language:CMake 7.9%