So my task is to implement a load function for a very simple server. And i cant really figure out where my segmentation fault is. I've tried to use GDB but since i use telnet with which i send http headers as input i've had a hard time with getting any results from it.
//Loads a file into memory dynamically allocated on heap.
//Stores address thereof in *content and length thereof in *length.
bool load(FILE* file, BYTE** content, size_t* length)
//checks so file is open
if(file == NULL)
char* buffert = malloc(BYTES * sizeof(char));
// read into buffert
fread(buffert, BYTES, sizeof(char), file);
//store the pointer of this buffert in content
*content = buffert;
length += 1;
// checks for eof
if(feof(file) != 0)
"...BYTE, which we’ve indeed defined as an 8-bit char."