I'm relatively new to python (I've been writing python code for about half a year now) and I'm trying to figure out how to use "seek" on larger files.
I'm doing some work with large hard disk image files, and the raw devices themselves. I need the ability to seek towards the tail end of a file that is extremely large (hundreds of gigs).
Below is an excerpt of the code I'm using:
f.seek(self.offset*512L) f.seek(self.sectors_per_cluster*self.start_cluster_mft*512L, os.SEEK_CUR) f.seek(record_number*512L*self.mft_cluster_size, os.SEEK_CUR) mft = f.read(512L*self.mft_cluster_size)
It looks like currently, the seek in python only allows me to use long (32 bit integers) as an offset in fseek, or maybe it's just that I can't use long long (64 bit) integers with Python under my current operating system. I don't know how to get around this limitation...
The Windows API can definitely work with large files, and in Linux I believe (if I remember correctly) I could use lseek64 using C.
Is there a way around this limitation with Python? Is there a library I can use, or any other way I do this without have to write some kinda crazy hack.
BTW, I'm using a 32 bit build of Windows XP and Python 2.5.