diff options
Diffstat (limited to 'string.h')
-rw-r--r-- | string.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/string.h b/string.h new file mode 100644 index 0000000..ecb49b6 --- /dev/null +++ b/string.h @@ -0,0 +1,19 @@ +#pragma once + + +struct string { + size_t len, cap; + char *data; // null-terminated +}; + +struct string string_make(const char *str); + +void string_free(struct string s); + +// Do not modify the length of the string. +char* string_read(struct string s); + +// Returns original length. +size_t string_append(struct string *s, char *arg); + +void string_truncate(struct string *s, size_t length); |