473,614 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1184
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**********@g mail.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
15219
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 pattern can occur on any byte boundary in the file, so chunking through the code at 16 bytes a frame maybe a problem. The file itself isn't so large, maybe 32 kbytes is all and the need for speed is not so great, but the need for accuracy in the...
4
15267
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 Server 2000 version of the table with the UTF-8 characters intact. Anyone know how to do this...efficiently? I've tried DTS and the high end UTF-8 characters get lost in the copy.
103
48582
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 says about it. What the heck does the binary flag mean? -- If our hypothesis is about anything and not about some one or more particular things, then our deductions constitute mathematics. Thus mathematics may be defined as the subject in...
2
2519
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 all records and sends each of them ONE BY ONE. After each record that my server script sends, it waits for the client to confirm proper reception with an ACK (binary digit). When there are no more records, my server script sends the client a binary
28
2771
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
4
3683
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 following code that compiles OK. It runs and shows the requested output. However, after execution, it pops one of those windows to send error reports online to the porgram creator. I have managed to find where the error is but can't see what's wrong....
6
2714
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, every now and then the client would timeout and have to re-initiate the request... TIA!
3
1703
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 want the information to be available for read access only. What is the potential for using Data Access pages for this task and what are the key questions/technologies I need to address before I can
3
1983
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 caching the dynamic pages. Once the data is updated, returning to the original viewing page shows the old data until you hit refresh. I know I can have my users adjust their internet file settings to "Check for newer versions of stored pages" to...
0
8198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8142
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8591
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8294
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5549
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.