-
File Handling problem
Hi,
I have written ftp client using VB.
In this i used Get, Put and Seek statements for the local file handling when uploading and downloading. But these statements are not supporting the files larger than 2G.
I decided to use CreateFile, ReadFile and WriteFile apis. But in case of these api how to seek the file pointer to the perticular location in the file ?
Please help me
Regards
Praveenp
-
SetFilePointer , SetFilePointerEx APIs move the file pointer of an open file.
-
but will the setfileptr move the file positon more than 2GB ? because api has the long parameters...
i want to seek the file more than 2GB. is it ok with setfileptr?
thanking you
Praveenp
-
ok..
long (4 bytes=32bits) can not store more than 2GB number..
but note that SetFilePointer :
declaration :
Code:
DWORD SetFilePointer(
HANDLE hFile, // handle to file
LONG lDistanceToMove, // bytes to move pointer
PLONG lpDistanceToMoveHigh, // bytes to move pointer
DWORD dwMoveMethod // starting point
);
as you see it takes the second argument as the 32 Low-order 32 bits (unsigned) and the third argument is a Pointer to the high-order 32 of the 64-bit (the total is 64 bits=8bytes which can store much more than 2GB)...
So you can exceed 2GB by using this function
See MSDN for details
hope this can help :)
-
Ya, I got it . Thanks for the INformation.
I converted the 64 bit value into two 32-bit values and passed to the setfilepointer.
It works fine.
Thanks again.
Praveen:)