#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0

    Thumbs up can anyone a binary file?


    I am wondering if anyone on this forum can read a binary file.

    If there is a way to do so, I would really like to know how to do it and what is contained in this file.

    I am curious on what does it take to accomplish this.
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Simple and easy, all you have to do is use the 'rb' or read binary flag instead of read i.e.

    gif = file('sample.gif', 'rb').read()

    Mark.
    programming language development: www.netytan.com Hula

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0
    I take it that you are referring to using Python to accomplish correct? Could you be a little more specific. Thank you
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    14
    No he can't be more specific ... he gave you all the code you need get the data into a variable. What more could you possibly ask for?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    3
    Rep Power
    0
    hmmmm, so you are a programmer? I am not. The obvious to you is not obvious to me. That is why the question was asked. Now if you asked me how would a person stop a Cisco 5850 for sending dual dial tones I could answer that, but this is not about that subject. I wanted information on a subject that I am not an expert on.
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Yup, all programmers here, well most of us! Nearly all have some programming experiance .

    Anyway yes, small as the code is, Python makes it amazingly easy...

    Mark.

    P.S. if i ever have a problem with that (Cisco 5850) i'll know where to come
    programming language development: www.netytan.com Hula

  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    4
    Rep Power
    0
    I think I understood what he asked.

    He is asking that if when faced with a random textfile you can just open it with any text editor and read what's in it, can you do the same with a binary file.

    The short answer is no. I you have no idea whatsoever in what format the data in the file is, you can't use it. It like being dumped into japan without a dictionnary and being expected to understand japanese.

    The long answer is that it is possible but that require a lot of efforts and time. It is called reverse-engineering. For instance, the Microsoft Office binary formats have been understood and used in the excellent OpenOffice.org

IMN logo majestic logo threadwatch logo seochat tools logo