CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Binary data

  1. #1
    Join Date
    Apr 1999
    Location
    UK
    Posts
    3

    Binary data

    How can I handle binary data in Visual Basic.
    Reading binary data from a file and dumping it
    to a serial com port.


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Binary data

    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

  3. #3
    Join Date
    Feb 2000
    Location
    South Carolina, US
    Posts
    36

    Re: Binary data

    '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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured