Public Sub ReadFile_2GB(xfilename As String, xlenFile As Double, xlenRec As Double, xStartRecord As Double, xRec As String, xFineFile As Boolean)
' ATTENTION record 1 is with DStartRecord = 0, the second has DStartRecord = 1...
' take care how you call this function!!!
Dim Temp As Variant
Dim i As Long
Dim Ilen As Double
'xlenRec = record len + CR/FL
If bFirstTime Then
F.SeekAbsolute 0, 0 'STARTING FROM POSITION 0 OF THE FILE (Seeks 2 bytes (0*2^32 + 2) = 1 character.
'----F.SeekRelative -2 ' Seeks forward 1 character (inizio file)
bFirstTime = False
Else
If xlenRec * DStartRecord < xlenFile Then
'test!!!!
If xlenRec * DStartRecord <= 2147483647 Then
F.SeekAbsolute 0, xlenRec * DStartRecord ' overflow with value = 2.147.483.647! because param is a LONG!!!!)
Else
'F.SeekRelative (xlenRec * DStartRecord) ' overflow with value = 2.147.483.647! because param is a LONG!!!!)
F.SeekAbsolute 1, (xlenRec * DStartRecord) - 2147483647 ' overflow with value = 2.147.483.647! because param is a LONG!!!!)
End If
Else
bEndFile = True
End If
'----F.SeekRelative (xlenRec / 2) + 2 ' Seeks aggiunge crlf!!!!
End If
Temp = F.ReadBytes(xlenRec)
Ilen = Len(Temp)
xRec = ""
'from unicode to ASCCI
For i = LBound(Temp) To UBound(Temp)
xRec = xRec & ChrW(Temp(i))
Next
xStartRecord = xStartRecord + 1
End Sub