Thanks for your help. So I tried that, and it seems to be outputting correctly.
Code:
short int test[2];
fread(&test, 2, 2, input);
printf("Test 1: %d\n", test[0]);
printf("Test 2: %d\n", test[1]);
Output:
Code:
Test 1: 2
Test 2: 0
The input file was created for the computer science course that I'm in, so I don't want to post it all. Here's a section of it though. The part I'm looking for starts at offset 8 and lasts for two bytes (and I know that it translates to 512).
Code:
offset asc hex dec oct bin
00000006: F 46 070 106 01000110
00000007: S 53 083 123 01010011
00000008: 02 002 002 00000010
00000009: 00 000 000 00000000
00000010: 00 000 000 00000000
00000011: 00 000 000 00000000
00000012: 19 025 031 00011001
00000013: 00 000 000 00000000
I have to do this kind of thing for the entire file, so I'm hoping that once I learn this part I'll be able to do the rest. By the way, I know for a fact that the file is in Big Endian form. I'm using Ubuntu for coding, so I guess that I'll have to convert (ntoh?) before I write back to the file.