Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to use SetFilePointer for more than 4 GB Files ?

Posted on 2003-11-04
2
Medium Priority
?
689 Views
Last Modified: 2013-11-13
Hi,

I have written a FTP Client using winsock VB. and providing the resume option for upload and download.
When transfering more than 2GB or 4GB files, I am not able to seek the file pointer to the huge files.
can anybodya please provide me some example to set the file pointer to the more than 4GB?

thanking you
regards
p01
0
Comment
Question by:p01
2 Comments
 

Accepted Solution

by:
pampati earned 300 total points
ID: 9686009
You need to convert the 64 bit value into two 32-bit values and pass those to the setfilepointer api.

Here is the example to convert 64 bit value to 32-bit values

Public Type MungeCurr
        Value As Currency
      End Type

      Public Type Munge2Long
        LoValue As Long
        HiValue As Long
      End Type

      Public Function convert64to32(ByVal Value As String) As Currency
      Dim L As Long, Negative As Boolean
        Value = Trim$(Value)
        If Left$(Value, 1) = "-" Then
          Negative = True
          Value = Mid$(Value, 2)
        End If
        L = Len(Value)
        If L < 4 Then
          TextToCurr = CCur(IIf(Negative, "-0.", "0.") & _
                            Right$("0000" & Value, 4))
        Else
          TextToCurr = CCur(IIf(Negative, "-", "") & _
                            Left$(Value, L - 4) & "." & Right$(Value, 4))
        End If
      End Function

and  call the above function like this.

        Dim C1 As MungeCurr
        Dim L As Munge2Long
        ' Convert a 64-bit value to two 32-bit values.
        C1.Value = convert64to32("1234567890123456")
        LSet L = C1
        SetFilePointer hFile, L.LoValue, L.HiValue, FILE_BEGIN

Hope this helps

Praveen Pampati
0
 

Author Comment

by:p01
ID: 9686255
Thanks for the code.
It works fine.

0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question