I can seem to only read file into memory if I explicitly declare the buffer size. This works
#include <stdio.h>
int main(){
FILE *fp = fopen("test.log", "rb");
char buffer[37];
fread(buffer, 1, 36, fp);
printf("%s", buffer);
}
This will add junk to the output
#include <stdio.h>
int main(){
FILE *fp = fopen("test.log", "rb");
fseek(fp, 0, SEEK_END);
long siz = ftell(fp);
rewind(fp);
char buffer[siz + 1];
fread(buffer, 1, siz, fp);
printf("%s", buffer);
}