bitshift

  • Thread starter Bill Cunningham
  • Start date
B

Bill Cunningham

I wrote some code that is now gone or I'd post it. This code took a jpeg
file of around 45Mb and I used the tilde operator to turn it "inside out". I
believe I was successful and when I tried to "reshift" the bits it didn't
work too well. Here's s snippet of what I can remember.

int a,b;
a=~b;

while ((a=fgetc(fr))!=EOF)
fputc(a,fw);

This might not be exact but once the shift was made and the file was
rendered incompatible it couldn't be restored.

Bill
 
L

Lew Pitcher

I wrote some code that is now gone or I'd post it. This code took a
jpeg
file of around 45Mb and I used the tilde operator to turn it "inside out".
I believe I was successful and when I tried to "reshift" the bits it
didn't work too well. Here's s snippet of what I can remember.

int a,b;
a=~b;

while ((a=fgetc(fr))!=EOF)
fputc(a,fw);

Not quite. Your original code was "to take an ELF format file and turn it
inside out". And the code was somewhat more involved than the sample you
posted above.
This might not be exact but once the shift was made and the file was
rendered incompatible it couldn't be restored.

Bill

Yes, Bill, and we discussed the problem when you posted your code.

You can find your original posting at
http://groups.google.com/group/comp.lang.c/msg/add65513a89893b8
and the entire thread (including the analysis of your code issues) at
http://groups.google.com/group/comp.lang.c/browse_thread/thread/5a37bd31826939b3/522175a9c67ec50b
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top