I am trying to read some data from a raw block device (/dev/hdx). This actually works fine using the standard I/O functions, except that ftell() fails with the following error, after processing data for a while:
"Value too large for defined data type"
Now this happens once offset 0x80000000 has been reached. This is actually obvious as a 32-bit variable can't hold more than a +/- 2GB offset. So I tried the ftello() function. Put a #define _FILE_OFFSET_BITS 64 into my code and ran the program again. But ftello() fails with exactly the same error that ftell() gives me.
Now I managed to resolve this problem by using relative offsets exclusively, in which case I do not need calls to ftell() anymore. I was left wondering however, how to obtain the current file position, as ftell()/ftello() apparently fail to do the job on my system. So does anyone know how this is done?