Alrighty then...

I am relatively new to C so forgive any incorrect terminology or whatnot.

My question has to do with a homework assignment I have been given. I am not asking anyone to do my assignment or anything of the sort I am just stuck on a part of it Id like advice on.

Basically the assignment is to take in an octal dump created by the od command and convert it back to text. Catch is we are not allowed to use arrays (ie strings) at all. We are supposed to work with bit operators.

We have to take a number such as 060523 and convert each digit back into octal form (except first 0, which is basically ignored in this entire process) like this 0110000101010011 and then convert each 8 digits (meaning binary number) back into its ASCII form.

Ive discovered that if you separate each digit of 060523 so you are only looking at 1 digit at a time, you can retrieve the octal version of it by shifting the bits 5 places to the right and then 5 places to the left.

My question is how to combine those together without using a string? For the 060523 example, I would have:

00000 110

00000 000

00000 101

00000 010

00000 011

(I put spaces to make it easier to understand)

but I need it to look like:

0110000101010011

Im assuming I need to somehow be able to manipulate the last three bits and then someone concatenate it together with the other 3 bit sets.

How on earth could this be done with bit operators? If I was able to use arrays I could easily concatenate them together but Im at a total loss on how to do it otherwise.

I REALLY appreciate any help!!!

~B.