can some wizard explain why i can’t get the file into my string?
long file(char *req_path, char *res_body)
{
FILE *file = fopen(req_path, "r");
long n;
struct stat st;
stat(req_path, &st);
n = st.st_size;
if(fread(res_body, 1, (size_t)n, file) != (size_t)n){
return -1;
}
res_body[n+1] = '\0';
fclose(file);
return n;
}
the string is big enough