Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you portably (x86 and AMD64) seek to a (>4GB) offset in a file?

Tags:

d

How can you portably (x86 and AMD64) seek to a (>4GB) offset in a file?

File.seek() accepts a long on AMD64 and an int on x86 (or a size_t on both).

I need it to accept a long on x86. How can I do this?

(I have horrible feeling that this is a limitation of seek in C, and that I'll have to do multiple relative seeks to get to a >4GB offset.)

Thanks,

Chris.

like image 452
fadedbee Avatar asked Sep 21 '11 07:09

fadedbee


1 Answers

std.stdio.File.seek takes a long but converts it to an int on Windows. That would be a limitation of Digital Mars' C runtime library. Judging by the source code, there are no other platform limitations.

like image 173
Vladimir Panteleev Avatar answered Dec 17 '22 02:12

Vladimir Panteleev