if
fp_len = ftell(fp);
prints 470
shouldn't this be printing "471" ? ( it prints 8. probably first line only )
char *text = malloc(sizeof(*text) * fp_len + 1);
int text_len;
text_len = sizeof(text);
printf("text-len: %d --- ",text_len);
full:
FILE *fp;
fp = fopen(path, "r");
fseek(fp, 0, SEEK_END);
int fp_len;
fp_len = ftell(fp);
printf("%d---", fp_len);
fseek(fp, 0, SEEK_SET);
char *text = malloc(sizeof(*text) * fp_len + 1);
int text_len;
text_len = sizeof(text);
printf("text-len: %d --- ",text_len);
fread(text, fp_len, 1, fp);
printf("%s",text);
free(text);