I am trying to use the fread function. In the code below, input_text stores values in bit units, but file_size represents the number of bytes. Because of this, wrong values are entered in the input_text array, and I am curious about how to solve this.
'''
fseek(Ptr_input, 0, SEEK_END);
file_size = ftell(Ptr_input);
fseek(Ptr_input, 0, SEEK_SET);
char* input_text = (char*)malloc((file_size) * 8 + 64);
if (input_text == NULL) {
printf("malloc failed.\n");
fclose(Ptr_input);
exit(1);
}
fread(input_text, 1, file_size, Ptr_input);`
'''
To sum up, what I want to do is to solve an error when trying to save values in the input_text array that stores values in bit units in the fread function, which processes values in byte units.