I can't seem to find a problem in my load and indexes function. I need help. Thank you!!
bool load(FILE* file, BYTE** content, size_t* length)
{
*content = NULL;
*length = 0;
BYTE temp;
while (fread(&temp, sizeof(BYTE), 1, file) == 1)
{
*length += 1;
*content = realloc (*content, *length);
memcpy(&content, &temp, 1);
}
return true;
}
char* indexes(const char* path)
{
char* temp = NULL;
char php[] = "/index.php";
char html[] = "/index.html";
temp = malloc(sizeof(strlen(path) + strlen(php)) + 1 - 2);
strcpy(temp, path);
strcat(temp, php);
if (access(temp, F_OK))
return temp;
free(temp);
temp = malloc(sizeof(strlen(path) + strlen(html)) + 1 - 2);
strcpy(temp, path);
strcat(temp, html);
if (access(temp, F_OK))
return temp;
free(temp);
return NULL;
}