Results 1 to 4 of 4

Thread: read Binary files *resolved*

  1. #1

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    read Binary files *resolved*

    It seems like every example i look at is the same..
    but i cannot get any output.


    How do i open a binary file and look at it??




    VB Code:
    1. Private Sub Command2_Click()
    2.  
    3.  
    4. Dim Path As String
    5.     Path = "C:\Documents and Settings\All Users\Desktop\test.exe"
    6.  
    7. Dim b() As Byte
    8.  
    9. ReDim b(FileLen(Path))
    10. Open Path For Binary Access Read As #1
    11. Get #1, , b()
    12. Close #1
    13.  
    14. Text1 = b()
    15.  
    16.  
    17.  
    18. End Sub


    Seahag
    Last edited by SeaHag; Dec 4th, 2002 at 04:58 PM.

  2. #2

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    VB Code:
    1. debug.print FileLen(path)   ' = 0   THATS NOT RIGHT?

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    See if this works......
    VB Code:
    1. Private Sub Command2_Click()
    2.  
    3.  
    4. Dim Path As String
    5.     Path = "C:\Documents and Settings\All Users\Desktop\test.exe"
    6.  
    7. Dim b() As Byte
    8.  
    9. Open Path For Binary Access Read As #1
    10. ReDim b(LOF(#1))
    11. Get #1, , b()
    12. Close #1
    13.  
    14. Text1 = b()
    15.  
    16.  
    17.  
    18. End Sub
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    I feel stupid.

    it didnt like

    "C:\Documents and Settings\All Users\Desktop\test.exe"

    ALL USERS was wrong.?

    i even went to the file. right clicked and cut and paste the
    file path..

    thanks for your help.





    Seahag

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