Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# How to use SetFilePointer for more than 4 GB Files ?

Posted on 2003-11-04
Medium Priority
684 Views
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
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

Accepted Solution

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

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

0

## Featured Post

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 describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
###### Suggested Courses
Course of the Month8 days, 13 hours left to enroll

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

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