The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
can anyone a binary file?
Discuss can anyone a binary file? in the Python Programming forum on Dev Shed. can anyone a binary file? Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 27th, 2003, 01:00 AM
|
|
Junior Member
|
|
Join Date: Dec 2003
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
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, 01:37 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
|
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
|

January 5th, 2004, 04:52 PM
|
|
Junior Member
|
|
Join Date: Dec 2003
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
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, 05:04 PM
|
|
Contributing User
|
|
Join Date: Dec 2001
Location: Houston, TX
Posts: 383
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 12
|
|
|
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, 06:38 PM
|
|
Junior Member
|
|
Join Date: Dec 2003
Posts: 3
Time spent in forums: < 1 sec
Reputation 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.
|

January 5th, 2004, 06:49 PM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
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 
|

January 24th, 2004, 01:15 AM
|
|
Junior Member
|
|
Join Date: Jan 2004
Posts: 4
Time spent in forums: < 1 sec
Reputation 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
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|