by Denis Petrusenko (6 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 5th June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Load a file with commas and everything.
Dim FreeF As Integer
Dim LocData() As Byte
Dim LenData As Long
Dim sendloop As Long
Dim fD As String
Const Chunk = 8192
FreeF = FreeFile
Open FileName For Binary As #FreeF
ReDim LocData(1 To Chunk) As Byte
LenData = FileLen(FileName)
For sendloop = 1 To LenData \ Chunk
Get #FreeF, , LocData
fD = fD & MakeStr(LocData)
Next
If LenData Mod Chunk <> 0 Then
ReDim LocData(1 To LenData Mod Chunk) As Byte
Get #FreeF, , LocData
fD = fD & MakeStr(LocData)
End If
Close #FreeF
LoadFile = fD
End Function
Function MakeStr(b)
Dim t As String
For x = LBound(b) To UBound(b)
t = t & Chr(b(x))
Next
MakeStr = t
End Function