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 2b01e38ca2 Various minor changes
- Removed trailing ';' from convenience macros.
- Convenience macros did not really need the ## __VA_ARGS__ extension.
Simply grouping all parameters into '...', while decreasing readability,
solves the portability issue.
- Added C99 check to dynstr.c.
2020-06-12 10:27:12 +02:00
include Various minor changes 2020-06-12 10:27:12 +02:00
.gitignore First commit 2020-03-19 18:40:31 +01:00
LICENSE First commit 2020-03-19 18:40:31 +01:00
README.md First commit 2020-03-19 18:40:31 +01:00
dynstr.c Various minor changes 2020-06-12 10:27:12 +02:00

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__);
    printf("%s", s.str);
    dynstr_free(&s);

    return 0;
}

Output:

Hello from main:10

License

See LICENSE file.