Click to See Complete Forum and Search --> : Binary data


Theo
February 10th, 2000, 06:22 AM
How can I handle binary data in Visual Basic.
Reading binary data from a file and dumping it
to a serial com port.

Chris Eastwood
February 10th, 2000, 07:47 AM
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

Weasel
February 10th, 2000, 07:55 AM
'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