Solved

XOR on byte

Posted on 1997-08-06
1
1,194 Views
Last Modified: 2012-06-21
How can I perform a XOR operation on 2 bytes?

example
00000110 (1st byte)
00000010 (2nd byte)

00000100 (result)

Another question is whether all files are stored in multiples of bytes?  Example, 12 bytes.  No files are stored in 12bytes 6 bits.

thanks
0
Comment
Question by:YamSeng
1 Comment
 
LVL 10

Accepted Solution

by:
rbr earned 20 total points
ID: 1252960
First question:

Try

unsigned char a,b,result;

a=(char)6;
b=(char)4;

result=a^b;

Second question:

Sure files are stored in multiples of bytes an all systems I know. DOS, Windows, OS/2, MAC, Linux. They are even stored in a large block. Almost every OS has an minimal block or cluster size, which are often a power of 2. So if your cluster size is e.g. 8192 a file which uses only 4 bytes will use 8192 bytes of your HD.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question