
thanks alot iMalc, i find your post later.. ok i understood how to work breaking these bits :) but how can i read these bits breaking it in 5..
like there are 2 bytes 00000000 01000100 and now i want to read 5 bits and replace it with a,b, c respectively..
i just knw to chck the complete byte through if (char = 'a')
how can i chck these 5 bits for decompressing??
like i have to work on small bits.. that if the next 5 bits == 00000 than replace with a
.....

I would focus on writing two complementary routines. One which takes a bunch of 8bit characters and packs them into say 5 bits, writing that out as each byte is filled, and one which does the opposite.
To do that, have some int variable that holds the bits, and another that holds the count of how many bits it is holding.
Example, storing 00000, 00001, and 00010:
First call:
data = ...0000000, bitsUsed = 5
Since bitsUsed is less than 8, we can't write anything out yet.
Next call:
data = ...0000 00000001, bitsUsed = 10
Now since bitsUsed is greater than 8, we can write out a byte to file. Using bit shifts we write out 00000000 and leave the remaining ..0001 in the buffer, decreasing bitsUsed by the amount we wrote out (8), leaving that set to 2.
Next call:
data = ..000100010, bitsUsed = 7
Not quite 8 bits used, so we cant write out anything yet.
However we've now reached the end, so we must flush out the remaining bits by writing a byte anyway. The last bit you just set to zero.
When reading it in the process is similar. After extracting three lots of 5bit values from the buffer, you'll be lewft with only 1 bit which is not enough for a 5bit code, you you just ignore it.

HEY!! I understood what you said and tried to make an algorithm which will work on this..... for Example
i created an ASCII like for 0(47) my 5bit ascii is 00000 for 1(48)00001 ..... for A(65) my ascii is 01011 for B(66) my ascii is 01100 and so on..
now i have charachter in
Code:
array arr[36]={0,1..........,A,B.........Z}
and compressed[(36*5)/8]= {(00000000),(01011000),.......,(..01011011),(00......)...........}
If i type SAQ
then with 111010101111011.
(11101010) 1st byte
first 5 contains alternate for S and 3 for A
i can extract it using Shift operator
(1111011.) 2nd byte
contains 2 bits for A
my question is that how can i extract last 2 bit from 1st byte and add it at the starting of 2nd byte ?????? so that 2nd byte can become (01011....)
help me plz!!!

The decompression is similar to the compression. When you want to read a 5bit value out, if your bitsUsed is less than 5 then you read in a byte, shift the existing data bits left 8 bits and or in the new 9 bits on the right. Lastly, you increase the bitsUsed by 8. Then you can perform your exract of 5 bits.
I hope that gets you there or most of the way because I'm going OTN (off the net) for a few days.