Solved

How to use SetFilePointer for more than 4 GB Files ?

Posted on 2003-11-04
2
677 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

734 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