Recreate base64 project
This commit is contained in:
23
base64/main.c
Normal file
23
base64/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "base64.h"
|
||||
#include "../wapp/wapp.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(10));
|
||||
|
||||
Str8RO text = wapp_str8_lit_ro("Testing some more stuff");
|
||||
Str8RO etext = wapp_str8_lit_ro("VGVzdGluZyBzb21lIG1vcmUgc3R1ZmY=");
|
||||
|
||||
Str8 *encoded_text = encode(&allocator, &text);
|
||||
Str8 *decoded_text = decode(&allocator, &etext);
|
||||
wapp_runtime_assert(encoded_text != NULL && decoded_text != NULL, "Failed to allocate strings");
|
||||
|
||||
printf("Encoded text: " WAPP_STR8_SPEC "\n", wapp_str8_varg(*encoded_text));
|
||||
printf("Decoded text: " WAPP_STR8_SPEC "\n", wapp_str8_varg(*decoded_text));
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&allocator);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user