Page 1 of 1

SetFilePointer_

Posted: Sun Aug 28, 2011 6:15 pm
by ALAN-MHz
Dear all,
i have problem using this function with very big size, i've read that i need to use lpDistanceToMoveHigh using scale to minimize lDistanceToMove value to int32, but all my try cause crash also in purebasic debug mode, anyone can help me to how to calculate right offset for very big numbers like 500 GB ?

Thanks

Best Regards

Re: SetFilePointer_

Posted: Sun Aug 28, 2011 8:49 pm
by Pupil
You need to use quads to calculate the offset. Also using a structure like this might help:

Code: Select all

Structure LargeInt
  Low.l
  Hi.l
EndStructure

Structure LargeOffset
  StructureUnion
    q.q
    ll.LargeInt
  EndStructureUnion
EndStructure

Offset.LargeOffset\q = 500*1024*1024*1024

SetFilePointer_(hFile, Offset\ll\Low, @Offset\ll\Hi, #FILE_BEGIN)
Code does not work as is, but you should be able to get the general idea how to call the function.

Re: SetFilePointer_

Posted: Sun Aug 28, 2011 9:28 pm
by freak
The PureBasic File library supports large files out of the box. All you have to do is use quads to store file offsets and that's all.

Re: SetFilePointer_

Posted: Mon Aug 29, 2011 9:24 am
by ALAN-MHz
Thanks, i'll try in next days ;)