I try to read value from binary file. I know offset (3201) and use it.
Example code:
FILE *bin_file;
int *job_id_buffer;
bin_file = fopen("sample.sgy", "rb");
if (bin_file == NULL)
{
// ... skipped ...
}
fseek(bin_file, 3201, SEEK_SET);
job_id_buffer = (int*)malloc(sizeof(int));
fread(job_id_buffer, sizeof(int), 1, bin_file);
printf("%d\n", (int)job_id_buffer[0]);
fclose(bin_file);
Looks like I don't know how to read value correctly.
But problem is that when I get result, the value is 993024, while I 100% know that correct value is 9999.
Could you, please, help me to understand what I do incorrectly?
Thank you in advance!