How can I handle binary data in Visual Basic.
Reading binary data from a file and dumping it
to a serial com port.
Printable View
How can I handle binary data in Visual Basic.
Reading binary data from a file and dumping it
to a serial com port.
You can read data from a file into a Byte Array by using the 'Open for Binary Access...' commands when opening a file,
eg
Dim bByt() as Byte
Dim iFile as Integer
'
iFile = FreeFile
'
Open "c:\test.dat" for binary Access Read as iFile
'
get #iFile, , bByt
'
Close #iFile
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
'Something along these lines, use MSCOMM32.OCX
'MSComm1 setup here
MSComm1.PortOpen
Open "c:\joe.txt" For Binary Access Read As #1
While Not EOF(1)
Line Input #1, foo$
MSComm1.Output foo$
Close #1
Wend