Solved

How to use SetFilePointer for more than 4 GB Files ?

Posted on 2003-11-04
2
680 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
pampati earned 75 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

630 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