December 27th, 2003, 02:00 AM
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.
December 27th, 2003, 02:37 AM
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()
January 5th, 2004, 05:52 PM
I take it that you are referring to using Python to accomplish correct? Could you be a little more specific. Thank you
January 5th, 2004, 06:04 PM
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?
January 5th, 2004, 07:38 PM
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.
January 5th, 2004, 07:49 PM
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...
P.S. if i ever have a problem with that (Cisco 5850) i'll know where to come
January 24th, 2004, 02:15 AM
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