SetFilePointer_

Just starting out? Need help? Post your questions and find answers here.
ALAN-MHz
User
User
Posts: 68
Joined: Fri Jul 29, 2005 11:47 am

SetFilePointer_

Post 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
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Re: SetFilePointer_

Post 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.
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: SetFilePointer_

Post 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.
quidquid Latine dictum sit altum videtur
ALAN-MHz
User
User
Posts: 68
Joined: Fri Jul 29, 2005 11:47 am

Re: SetFilePointer_

Post by ALAN-MHz »

Thanks, i'll try in next days ;)
Post Reply