- [FIX] No estava tancant ningun arxiu, que peiv
This commit is contained in:
5
main.cpp
5
main.cpp
@@ -20,12 +20,17 @@ bool must_link = false;
|
||||
char *getBufferFromFile(const char* filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (!f) {
|
||||
perror("Error opening file");
|
||||
exit(-1);
|
||||
}
|
||||
fseek(f, 0, SEEK_END);
|
||||
long size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
char *buffer = (char*)malloc(size+1);
|
||||
fread(buffer, size, 1, f);
|
||||
buffer[size] = 0;
|
||||
fclose(f);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user