Swinging in a different direction, different syntax

This commit is contained in:
Krzosa Karol
2022-05-01 13:51:34 +02:00
parent 3a9b748fed
commit c5498b03ad
14 changed files with 903 additions and 116 deletions

View File

@@ -22,6 +22,22 @@ WinMain(HINSTANCE hInstance, HINSTANCE a, LPSTR b, int nShowCmd){
return os_main();
}
function String
os_read_file(String name){
String result = {};
FILE *f = fopen((char *)name.str, "rb");
fseek(f, 0, SEEK_END);
result.len = ftell(f);
fseek(f, 0, SEEK_SET); /* same as rewind(f); */
result.str = malloc(result.len + 1);
fread(result.str, result.len, 1, f);
fclose(f);
result.str[result.len] = 0;
return result;
}
function OS_Memory
os_reserve(SizeU size){
OS_Memory result = {0};