diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 12:43:38 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-05 12:43:38 +1000 |
commit | 54354e32c6498cc7f8839ab4deb1208d37216cc5 (patch) | |
tree | 7759597b971ba59d6af841a5bed793c229dd4c2b /examples/standard_lib/ex_std.c | |
parent | be8ab99b38c25e899008582d68e891150b328a4d (diff) |
Begin simplifying project structure and removing examples
Diffstat (limited to 'examples/standard_lib/ex_std.c')
-rw-r--r-- | examples/standard_lib/ex_std.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/standard_lib/ex_std.c b/examples/standard_lib/ex_std.c deleted file mode 100644 index 9d474de..0000000 --- a/examples/standard_lib/ex_std.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include "file.h" -#include "str.h" - -int main() { - // Examples of how to work with arenas and strings - size_t arena_size = 1024; - arena scratch = arena_create(malloc(arena_size), arena_size); - arena* a = &scratch; - - str8 hello = str8lit("Hello World"); - - // this works but we should be careful because str8 is not *guaranteed* to point to - // a null-terminated string - printf("String before: '%s' (null-terminated: %s) \n ", hello.buf, - str8_is_null_term(hello) ? "true" : "false"); - - char* c = str8_to_cstr(&scratch, hello); - - printf("String after: %s\n", c); - - str8_opt test_file = str8_from_file(&scratch, str8lit("assets/shaders/ui_rect.vert")); - if (test_file.has_value) { - printf("Contents: %.*s \n", (int)test_file.contents.len, test_file.contents.buf); - printf("Null-terminated: %s\n", str8_is_null_term(test_file.contents) ? "true" : "false"); - } - - return 0; -} |