473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Viewing Binary Data

Hello,

I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.

Cheers!

Cuyler

Jan 7 '06 #1
6 1176
This recipe is a good place to start:

http://aspn.activestate.com/ASPN/Coo.../Recipe/440528

Cheers

Rich.

Jan 8 '06 #2
Cuyler wrote:
Hello,

I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.

Cheers!

Cuyler

You may consider to check out the latest by me started thread in this
newsgroup with the subject: "Does Python allow access to some of the
implementation details?", which surprizingly deals mainly with getting
bits out of strings and integers and provides appropriate code.

Claudio
Jan 8 '06 #3
Cuyler wrote:
I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.


I'm sure the list archives (visible via Google Groups and other means)
has answers to similar questions in the past. Also the online Python
CookBook probably has at least one recipe that would help. Have you
tried searching online at all?

-Peter

Jan 8 '06 #4
Cuyler wrote:
I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.


If you are on a UNIX system, or on Windows with Cygwin, you can use the
'od' command to dump a file in hex or octal.

man od
od -Ax -tx1
Jan 8 '06 #5
On 6 Jan 2006 09:15:50 -0800, "Cuyler" <cu**********@gmail.com> wrote:
Hello,

I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.

What have you tried? "having no luck" doesn't tell us much, although it is
a phrase previously seen in use ;-/
Is this homework?

If the first character were 'C' what order would you like to see the bits?
(e.e., 1000011 (big-endian l-r) vs 1100001 (little-endian l-r)
Do you want to convert the whole file like a hex dump, except binary?
Want to give a clue as to output format? Gapped? Ascii at the right?
Bit numbers or hex byte offsets at the left?
Do you need a one-liner solution?

Regards,
Bengt Richter
Jan 8 '06 #6
Paul Watson wrote:
Cuyler wrote:
I would like to display a file in its binary form (1s and 0s), but I'm
having no luck... Any thoughts would be most appreciated.

If you are on a UNIX system, or on Windows with Cygwin, you can use the
'od' command to dump a file in hex or octal.

man od
od -Ax -tx1

And if you're on a Linux system and have KDE loaded, use the KHexEdit
utility. KHexEdit can display the file in hexadecimal, decimal, octal,
binary or text format, swap endians, search, filter, etc. It's a very
sweet utility.
Jan 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the...
4
by: CJ Butcher | last post by:
Hi, I have a need to pull information from an Oracle 9.2.1 database. It is storing UTF-8 characters in a varchar2(33) field. I need to be able to pull these values out and put them in a SQL...
103
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it...
2
by: Lisa Pearlson | last post by:
Hi, My php application (on Apache/Linux) needs to do the following: The PHP script receives a request from a client (binary), asking for certain records of data. My PHP script loops through...
28
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
4
by: knapak | last post by:
Hello I'm a self instructed amateur attempting to read a huge file from disk... so bear with me please... I just learned that reading a file in binary is faster than text. So I wrote the...
6
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios,...
3
by: tom.youdan | last post by:
Hi, I have created a database that is used to store contact information for NGO's accross India. It is simple in structure and I want a portion of the data to be viewable on the Internet. I...
3
by: Tom | last post by:
I have a PHP 4.4.7, MySql 5.0 and I.E. 7. My PHP queries the database and renders the info into html forms. Submitting the forms manipulates the data. Now, the problem is that the browsers are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.