I'm having an issue trying to convert a Binary File into a text file. Right now, I'm getting an output of "hello 16". I should be getting 5 lines of output, in which the first line should be "hello 32". I'm unsure where I went wrong, but I've been trying to figure it out for a few hours now. Link to Binary File
void BinaryToText(char *inputFile, char *outputFile) {
unsigned char str[256];
unsigned int num;
int fileLen;
FILE *finp;
FILE *fout;
finp = fopen(inputFile, "r");
fout = fopen(outputFile, "w");
fseek(finp, 0, SEEK_END);
fileLen = ftell(finp);
fseek(finp, 0, SEEK_SET);
while (fread(&fileLen, sizeof(char), 1, finp) == 1) {
fread(&str, sizeof(str), 1, finp);
fread(&num, sizeof(int), 1, finp);
fprintf(fout, "%s %d\n", str, num);
}
fclose(finp);
fclose(fout);
}