rpg_rpg
asked on
how to start reading information...
I would like to make a control to put a bunch of files together and then seperate them. My first problem is... how do I open the file(meaning any file) and start reading the information of that file into VB? It should not matter what file it is or what it contains... The computer sees it the same way. (Just a bunch of numbers) right???
... Access Read ...
Good catch Chabaud!
ASKER
so what is vVar going to = ? the entire file or just the first byte... And after?
Vvar will equal the first byte the first time it is called, every subsequent call, it will be equal to the next byte.
So, to read an entire file a byte at a time, this code will work:
Dim btVar As Byte
Dim nFile As Integer
nFile = FreeFile
Open "TESTFILE" For Binary Access Read As #nFile
Do Until EOF(nFile)
Get #nFile, , btVar
'Do what you want with btVar
Debug.Print btVar
Loop
Close #nFile
(Thanks to chabaud for pointing out my Access Write error)
So, to read an entire file a byte at a time, this code will work:
Dim btVar As Byte
Dim nFile As Integer
nFile = FreeFile
Open "TESTFILE" For Binary Access Read As #nFile
Do Until EOF(nFile)
Get #nFile, , btVar
'Do what you want with btVar
Debug.Print btVar
Loop
Close #nFile
(Thanks to chabaud for pointing out my Access Write error)
ASKER
clifABB: you did not use this as an answer. Could you please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open "TESTFILE" For Binary Access Write As #1
Then use Get to input the data:
Get #1, , vVar