Solved

XOR on byte

Posted on 1997-08-06
1
1,191 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-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.

777 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