Archived

This topic is now archived and is closed to further replies.

Removing a Byte value

This topic is 5828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I have a following problem, which I think is quite hard to solve... Let’s say I read a file in size of Byte values. File has thousands of Byte’s of all possible values from 0-255. How can I drop a value out and write a new file, which does not have the dropped value. Without increasing the size of the new file dramatically? And of course I should be able to restore the old file from the new file. For example: I drop out value 200. I read the original file in size of Byte values and write the new file that does not have the value 200. My current solution: I will replace the value 200 with a sequence of Byte values that could not previously be found in the file. Like 177 and 87. When I find the value 177 and 87 in the new file I will put instead of these values value 200 in restored file. But this method has two drawbacks: somewhere in the file I have to write information of this sequence that can be quite long. And for each 200 value I am writing more information than was previously. So the size of new file is growing. Does anybody have a better solution for my problem? I was thinking of some kind of mathematical function but haven’t figured out anything yet. Floru

Share this post


Link to post
Share on other sites

I''m just trying to modify a file so that it does not contain a specific Byte value. But the method should work in both ways. So that I can recover the original file from the file which does not have specific Byte value.

Floru

Share this post


Link to post
Share on other sites
Well, if you want to represent the full spectrum upon reconstruction, realize that you are trying to do just that without using the full spectrum.

Certain file patterns will work. Not all file patterns will work. For a general solution, you''re screwed.

Share this post


Link to post
Share on other sites
look into RLE (run length encoding). use control bytes to determine how to interpert the values you are reading. please explian WHY you are trying to do this.

Share this post


Link to post
Share on other sites