
David W. answered 09/23/15
Tutor
4.7
(90)
Experienced Prof
Calvin,
The very basic point you are making is that computers store information in binary and it is often grouped into groups of 8 (called bytes) or larger (with other names such as strings, integers, real, etc.). The interpretation of the data is critically important.
So, a byte may contain a small integer. It may contain an ASCII character. It may contain a Boolean (T/F) value. It may contain part of the color-code of a jpeg or png or other picture. Notes: (1) the number of colors in the picture files determines how many bits each pixel will take because 3 colors must be represented, and (2) hiding "bits" of non-picture data in a picture files (called steganography -- see Wikipedia -- is extremely difficult to decrypt).
In almost every operating system, the extension (e.g., ".txt") of the file is only used to determine which program should read the file by default (e.g., when clicking on the file name). It may contain absolutely any binary information and it makes no difference until the program (e.g., Photoshop) tries to translate it into a picture.
So, check out the many, many web sites that have examples of reading a binary file using C++. Microsoft has an example at:
https://msdn.microsoft.com/en-us/library/3f3t7tke.aspx
p.s., The process of changing a binary file's data is commonly called "Patching." The Internet also has lots of examples of Patch programs.
p.s.-2. PLZ adhere to software licensing (which often disallows reverse engineering and modifying binary files).
Calvin W.
09/24/15