I just made my first encryptor/decryptor program in C++.It can encrypt any text files without any problems at all. However, I wanted to be able to encrypt and decrypt any file type, without corrupting it. Once I tried to open a .jpg file just for fun in notepad. I copied all the content of the file into an empty document. Then I saved it as a new .jpg file. However, this does not work because when I try to open it with the image displaying program, it says that the file is ruined/can not be opened. Why can you not copy the raw data of image files and other files without corrupting them like this?
I have never been an expert when it comes to this topic so please explain what happens.