Results 1 to 4 of 4

Thread: get bytes from file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245

    get bytes from file

    Hi,

    I know how to do this with VB6 but have not figured it out with VB.NET, any help would be much appreciated.

    I have a bitmap on the server which the VB.NET app needs to open and get all the bytes to an array for processing.

    Here's the VB6 code I used for the old version:

    Code:
        Open strFile For Binary As #f
            Get #f, , sArray()
        Close #f
    and here's how far I've gotten with VB.NET:

    Code:
    FileOpen(1, SrcFile, OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Shared, -1)
          'WHAT GOES HERE?
    FileClose(1)
    Thanks for your help.

    - Jake

  2. #2
    New Member Masta's Avatar
    Join Date
    Aug 2003
    Posts
    13
    here is a thread doing wat your trying to do I think http://www.vbforums.com/showthread.p...hreadid=259800

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Location
    california
    Posts
    245
    that's close but I just want to get all bytes from the file into any array. I don't want any one section of the bytes, I want them all.

    - J

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    VB Code:
    1. Dim fs As New FileStream("C:\test.tst", FileMode.Open)
    2.         Dim r(fs.Length) As Byte
    3.         fs.Read(r, 0, fs.Length - 1)
    4.         fs.Close()
    5.         'r now contains all bytes

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