-
November 4th, 2003, 04:25 AM
#1
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
-
November 4th, 2003, 08:52 AM
#2
SetFilePointer , SetFilePointerEx APIs move the file pointer of an open file.
-
November 4th, 2003, 07:47 PM
#3
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
-
November 5th, 2003, 08:29 AM
#4
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
-
November 6th, 2003, 02:53 AM
#5
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|