Swinging in a different direction, different syntax
This commit is contained in:
16
os_win32.c
16
os_win32.c
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user