Suppose I have a file like this:Are you saying it contains the bytes 0x30, 0x0D, 0x0A, 0x31, 0x0D, 0x0A, 0x32, 0x0D, 0x0A, 0x33 (assuming little endian and typical windows text formatting)?
Or are you saying it contains something like 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00?
The distinction is important. But I'll assume the latter as that's what the rest of your question implies.
and I can use fread [...3 times...]Reading a file does not change its content. Think of a FILE as containing a pointer or cursor in it somewhere that is moved along every time you read something from the file.
exactly like that,will mFile contain:
The first fread() call will read an int (on success) and advance the cursor sizeof(int) bytes, so that the cursor is now at 0x02,00,00,00 (again assuming 'binary' formatting).
The fseek() function allows you to change the position of this cursor. ftell() tells you its position.
Not sure if this answers your question directly, but I hope it helps.