D
Size: a a a
D
j
j
RX
j
j
j
CC
char* load_shader_from_file(char* filename)
{
FILE* file = fopen(filename, "r");
if (!file)
{
return 0;
}
int chunk = 128;
char* result = (char*)malloc(chunk + 1);
fread(result, 1, chunk, file);
size_t pos_in_file = ftell(file);
int reads_done = 1;
while (reads_done * chunk == pos_in_file)
{
result = (char*)realloc(result, chunk * (reads_done + 1) + 1);
fread(result + reads_done * chunk, chunk, 1, file);
pos_in_file = ftell(file);
reads_done++;
}
result[pos_in_file] = 0;
return result;
}
CC
char* load_shader_from_file(char* filename)
{
FILE* file = fopen(filename, "r");
if (!file)
{
return 0;
}
int chunk = 128;
char* result = (char*)malloc(chunk + 1);
fread(result, 1, chunk, file);
size_t pos_in_file = ftell(file);
int reads_done = 1;
while (reads_done * chunk == pos_in_file)
{
result = (char*)realloc(result, chunk * (reads_done + 1) + 1);
fread(result + reads_done * chunk, chunk, 1, file);
pos_in_file = ftell(file);
reads_done++;
}
result[pos_in_file] = 0;
return result;
}
RX
CC
CC
D
D
j
D
p
D
j