I'm not sure if what I did makes sense but here's the code for the load function:
if (file != NULL) {
char c;
int counter = 0;
while ((c = fgetc(file)) != EOF) {
counter++;
}
char* fileContent = malloc((counter + 1) * sizeof(char));
counter = 0;
rewind(file);
while ((c = fgetc(file)) != EOF) {
fileContent[counter] = c;
counter++;
}
*content = fileContent;
*length = counter;
return true;
}
return false;
When I test it with HTML files, it works, but not with PHP or JPG. Help?