an stb-style single header lib for length-prefixed strings in C, in ~50 LOC.
Find a file
2026-04-07 13:58:49 +09:30
test Add source 2026-04-07 13:58:49 +09:30
LICENSE Add source 2026-04-07 13:58:49 +09:30
lstr.h Add source 2026-04-07 13:58:49 +09:30
README.md Add source 2026-04-07 13:58:49 +09:30

lstr

an stb-style single header lib for length-prefixed strings in C, in ~50 LOC.

from the primary type's definition:

lstr is a length-prefixed string that looks and
behaves like a standard null-terminated string.

It can only be created, modified and freed by
lstr_* functions, but it can be read by standard
null-terminated string readers, like printf.

usage

#define LSTR_IMPLEMENTATION before lstr.h in one source file, and include lstr.h wherever it's used.